Now I would like to only display latest date which is - 6/29/2019
So I modify the function to:
History.Filter(Content=thisRow).Max()
Which results in the incorrect date 6/15/2019.
Wrong argument type
Max expects parameter value to be a number, a list of numbers, a date/time value, a list of date/time values, a formatted number, a list of formatted numbers, a percentage, a list of percentages, a currency amount, a list of currency amounts, a time duration, or a list of time durations, but found History.Filter(Content=thisRow), which can match a table, or a table.
I also tried the following function:
History.Filter(Content=thisRow).Last()
Which again results in a different date - 6/3/2019
Can anyone please let me know how to display the last date?
Hi Jimmy, this is something that confused me as well when I first ran into it. Think about what this formula is doing…
You’re taking the history table as a whole and filtering it down. The filter works because it acts on the column you’ve specified as the display column but the result of the filter is a set of entire rows (represented by the display column), not a set of dates. It looks like a set of dates but it’s actually a set of row references (You can see where this is going…)
If you then apply the max() function to it you’re finding the highest row, not the latest date. It’s probably ordering on RowID or something, which is obviously not what you want.
Thankfully, the solution is dead simple: just specify the date column before the max function. So, change the formula from:
I’m not at the computer right now, but I think I understand the problem. When you apply .Max() to a set of rows, it selects the max one NOT by filter condition (Max doesn’t know about filter condition at all) but perhaps by the display column (one with the bookmark icon).
You should try replace .Max() with .Sort(Date).Last() to get the row with max date. Or just .Date.Max() to only get the max date value, yeah
problem with this formula is I get the last row, not necessary the latest date if they are not sorted.
I tried to use sort, but then I can’t get the cost value
any suggestions?
I would love to keep it in one column, and not create an extra column for the date and use that as a reference. (since I need this in 12 columns) But if needed, that will be my way to go.