Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select the maximum value in an expression in a filed in qlik sense

Hello

I have a field which called PERIOD , I would like to ONLY choose the maximum value (or the last value) of that filed automatically

How I do it in the Field expression

Capture.JPG

7 Replies
swuehl
MVP
MVP

Are you talking about using the max value in aggregations in your expression, i.e. we may talk about using set analysis?

Then try maybe

=Sum({<PERIOD = {'$(=Maxstring(PERIOD))'}>} Value)

Not applicable
Author

You can try like these

Maybe it  should work

sum({<PERIOD = {"$(=max(PERIOD))"}>}value)


Thanks,

Bob

Not applicable
Author

Hi Stefan

Thanks for your replay but my period variable are NUMERIC

Not applicable
Author

Worked, thanks a lot

Gysbert_Wassenaar

Afaik you can't automatically select a value yet in Qlik, Sense. There's no OnOpen trigger like in Qlikview. What you can do is change your chart expression so that by default they calculate the result for the maximum PERIOD value. When nothing is selected that will automatically mean the maximum value. If the user does select one of more values then the maximum value of that selection is used. Your PERIOD field seems to contain numeric values so the max function should work fine. If for example your chart contains an expression sum(Inventory) you would have to change it to sum({<PERIOD={$(=max(PERIOD))}>}Inventory). You'd have to make similar changes to all the expressions in all the charts.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

David Behar wrote:

Hi Stefan

Thanks for your replay but my period variable are NUMERIC

Ok, but I would assume that my expression should have work also with numeric values.

Anyway, since your issue seems to be resolved, please close this thread by flagging helpful and / or correct answers.

Qlik Community Tip: Marking Replies as Correct or Helpful

Not applicable
Author

Thanks

It worked also