Filter lookup and then get latest value

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

Self-hosted

What do you need help with?

I have 2 tables:
v1_klienci - list of clients
v1_sprzedaz - list of sales for each client.

Both are linked.
In v1_klienci there is linked field v1_sprzedaz.

My goal is to create field in v1_klienci to get latest specific sale to show expiration duration for sale.
I was able to do trick with date - because it has fixed length.
Now I want to do the same for duration which is not fixed anymore. Values could be like :-90, 234,1,24.

max(filter(
lookup(‘v1_sprzedaz’, ‘valid_for’)
,
lookup(‘v1_sprzedaz’,‘is_X’) = true
))

I got:

Error with formula: argument number 1 given to function max was of type array but the only usable type for this argument is a list of text, or number, or char, or date, or duration values obtained from a lookup.

In attachment you can find screenshots of values I want to max.

Please attach screenshots or videos if they help illustrate your question.

Screenshot from 2025-07-02 05-46-49.png