Max and Filter interactions

Please fill in the questionnaire below.

Have you read and followed the instructions at: *READ ME FIRST* Technical Help FAQs - #2 by nigel ?

Answer: No I have not

Describe the problem

We’re having trouble with a formula that used to work just fine before.

Describe, step by step, how to reproduce the error or problem you are encountering.

Here is the formula in question :
left(totext(max(filter(lookup(‘3-Inscriptions-et-appels’,‘Date et heure’),not(isblank(lookup(‘3-Inscriptions-et-appels’,‘A décroché’)))))),10)

The max and filter formula seem to have an order of priority that recently changed. If that’s not the case, ignore my remark but there is still something wrong here since this request works fine without the max() and bugs as soon as it’s put into place

Provide screenshots or include share links showing:

Not sure it’s useful but there :

(the dates that are shown in the colomn aren’t the ones that should show up. For instance, all the “A décroché” slots are empty for those examples in particular. It feels like the max() overrides the filter() command)

How many rows in total do you have in your Baserow tables?

5488 rows on may the 31st at 13:11 GMT+2 - Paris

Hello @Paragon,

Could you please provide more details about the structure of your tables, the data you have, and the formula expected results?

Ofc, sorry I didn’t think about it first.

Ok so 2 tables are “communicating”. 1-Adhérents-et-Sympathisants and 3-Inscriptions-et-appels

This formula appears in table 1 in a column named Dernier Appel and is supposed to look at the A décroché column in table 3 first and tell us whether it’s empty or not.

If it is (which it is), it’s supposed to give us an empty case in the Dernier Appel column in table 1 but instead it manages to still give us a date ! If we take max() off, it works (I mean, it lists all the dates without selecting the highest one so it’s annoying)

I hope these explications help, if not I’m doomed haha

Ok, I think I get it now.

I’m unsure why it’s not working, but I’ll investigate it.

For now, as a workaround, you could create a formula field in table 3 with something like: if(field(‘A décroché’), field(‘Date et heure’), '')

Then in table 1 you can do: max(lookup('3-Inscriptions-et-appels’, '$new-formula-field-name'))

You can convert it back to a date, of course, with todate and a proper date format.
I hope this help,
davide

I’ve been toying around with your idea to split the formulas.
I created a booleen in table 3

And tried to manually create a filter with an if but it still doesn’t want to function …
Capture d'écran 2024-06-01 005103

Let’s say the “Formule” field is: if(field(‘A décroché’) = "Oui", field(‘Date et heure’), ‘’), then in table 3 you can lookup this field with max(lookup('3-Inscriptions-et-appels’, 'Formule')) .

It worked !
Thanks a lot !

Please let me know if you found the issue with my previous formula.

Hey @Paragon,

just a heads-up that a fix for this bug is in the review phase and will be part of the next release: Resolve "Aggregation formulas ignore filter inside" (!2459) · Merge requests · Baserow / baserow · GitLab.
Once released, you can use the filter inside max or other aggregating formulas as expected.

Thanks for your feedback

Thanks for the headsup ! I’m looking forward to it