Comparing two workdates to return the latest date.

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a project management app that uses predecessors.  There are two possible outcomes in my workflow where I want to compare two different task completion dates and use the highest as the project finish date.  
I created two summary fields based on my two possible task completion dates (work dates).  Then I created a formula date field to show the result of the comparison.  I was trying to use the MAX function:

MAX([summary date 1],[summary date 2])

I am getting a syntax error, and I have had no luck rearranging the components of the formula.  Has anyone else used MAX on work dates?
Photo of Sharon

Sharon

  • 90 Points 75 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
What is the syntax error - but aside from that, try thisd

Max(ToDate([summary date 1], ToDate([summary date 2]))

Maybe those summary fields are Work date field types.
Photo of Sharon

Sharon

  • 90 Points 75 badge 2x thumb

Good Morning!

Now the error is a mismatched set of parenthesis....

Max(ToDate([Summary 2 of Final task date completed], ToDate([Summary of final task date completed]))  

Yes, Both of the Summary dates are WorkDates.

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
Try this

Max(
ToDate([Summary 2 of Final task date completed]), ToDate([Summary of final task date completed])
)  
Photo of Sharon

Sharon

  • 90 Points 75 badge 2x thumb
It accepted that formula, Thank you!  However it is returning the earlier date.  One task was completed on 10-12-16 the other was completed on 1-30-17.  This field now shows 10-12-16.  Any thoughts?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
Can you tell me what dates are in each of those two fields?
Photo of Sharon

Sharon

  • 90 Points 75 badge 2x thumb
Summary of final task date completed = 1/30/17,  Summary 2...= 10/12/16
Photo of Sharon

Sharon

  • 90 Points 75 badge 2x thumb
Never mind, just as I suspected, that problem is on my end.  Has to do with where they are pointed. Thank you so much for the help with the formula!  When I fix the background it should work like a charm. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
:)  Great.