Jun 26, 2018 10:23 PM
I have two rollups, one for “latest morning absences” and another for “latest evening absences”. What formula do I use to return the latest of the two?
Feb 22, 2019 01:39 PM
How do I use MAX() with two regular date values? I tried MAX({Start Date},{End Date}) but it always returns 0.
Feb 22, 2019 08:16 PM
I don’t believe MAX()
is intended for use with dates. That’s why the IS_BEFORE()
and IS_AFTER()
functions were mentioned. The comment immediately above yours contains a full formula example.
Feb 23, 2019 03:07 AM
It works with dates, for instance in a Rollup field:
Feb 25, 2019 08:43 AM
Yes, it works in rollup fields, but the question from @Dan_Weaver above was about comparing two regular date values, specifically pointing to an issue using MAX(). In formulas, MAX() doesn’t work with dates. Only numerical values.
May 09, 2019 12:31 PM
I wish there was a MAX_DATE function. This monstrosity is what I used in its place:
DATETIME_FORMAT(DATETIME_PARSE(MAX(VALUE(DATETIME_FORMAT(IF({Publish Date}, {Publish Date}, '0'), 'X')), VALUE(DATETIME_FORMAT(IF({Due Date}, {Due Date}, '0'), 'X')), VALUE(DATETIME_FORMAT(IF({Completed Date}, {Completed Date}, '0'), 'X'))), 'X'), 'YYYY-MM-DD')
You can see I convert all the dates to a number using VALUE(DATETIME_FORMAT(IF
. The IF
is needed because you get an error for empty cells with DATETIME_FORMAT
. The VALUE
is needed because MAX
doesn’t work with strings. Then at the end I format it back to a date.
Jan 05, 2020 05:23 PM
If I need to find the max or min values of a date field I do the following:
Sep 30, 2020 10:21 AM
What would be a way to return last date of the call that already happened.
One of the dates is in the past and the other in the future.
So a rollup field won’t work
Sep 30, 2020 12:24 PM
Use a conditional rollup when calculating the maximum date. Set the condition to include only dates that are on or before today.
Sep 30, 2020 12:30 PM
How would I miss this!
Thank you @kuovonne.
Oct 09, 2020 03:24 PM
Your approach is very smart but the time formatting is wrong. I also used INT instead of hacking +0 to parse it to an integer. Other than that, great… too bad AirTable does not provide a better way to do this. It’s definitely not a friendly way to do it, in particular if you have 4 or 5 dates.
DATETIME_PARSE(MAX(INT(DATETIME_FORMAT({DATE1}, ‘YYYYMMDD’)),INT(DATETIME_FORMAT({DATE2}, ‘YYYYMMDD’))),“YYYYMMDD”)