Max() and Date columns

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

SaaS

What are the exact steps to reproduce this issue?

In one table I have a certain member, “Leo BONTEMS” who was called 3 times (as shown in screenshot #1)
In a second table, listing all members, I try to get the last time that guy was called.
I’ve tried two formulas so far

  • if(lookup(“3-Inscriptions-et-appels”, “1-Contact lié”)=field(‘Contact’), max(lookup(“3-Inscriptions-et-appels”, “Date et heure”)),“”)
  • max(lookup(“3-Inscriptions-et-appels”, “Date des appels”)))

But both times, max() will just give me the highest “day” of the date. Maybe it’s because it’s set to the American date format ? Idk but I’d love it to have a way to have a formula to have the latest date.

Attach screenshots, videos, or logs that demonstrate the issue.


I think it is because it is an array, it’s treating it like a string instead of a date. That’s my guess at this time. Could you try one thing?

Use a Rollup field instead of a Formula+Lookup

  1. In your Members table (the one where you want the “last time called”), create a Rollup field.
  2. Point it at the relation with your “Inscriptions-et-appels” table.
  3. Roll up the Date et heure field.
  4. Choose the aggregation function “Max”.

Thanks for the reply !

I’ve tried your way but since the column I’m trying check is a formula which happens to give a date, it seems like max() considers it as alphanum and gets the highest number (which in UE standard is DD and ignores MM/YYYY.

I’ve tried to add todate() to the formula but I can’t seem to make it work… I’ll keep y’all posted

Ok so I’ve found a workaround.

You need to do these steps to replace a date format like this DD/MM/YYYY TT:TT into DD-MM-YYYY :

  • left(replace(replace(replace(replace(totext(field(‘Date et heure’)),“/”,“”) ," “,”“),”:“,”“),” “,”"),-4), “”)
  • max(todate(lookup(“table”, “Date des appels”),’DDMMYYYY"‘))

So date into text then format, then back to date. (and max() works fine with date formats)

Thanks for sharing the solution @Paragon and really great work putting that formula together! Now that I see it, I realise it makes sense to do it this way!