Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Select The Last two selected from a list

Hello All,

Suppose i have a list of Month like:   Jan, Fev, Mar, Apr, Mai, ... , Dec

and

Suppose that the user has selected Fev, Apr and Dec.

And then i have a table that shows

Sum({<Month={'=Max(Month)'}>} Sales) / Sum({Month={'=Somenthing to get Max(Month) - 1 from the Selection'}>} Sales)

How can i get the last but one (penultimate?) user selection?

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can specify the rank as second parameter to max() function.

max(Month,2) will return the second highest Month

So maybe use something like

Sum({<Month={'$(=Max(Month))'}>} Sales) / Sum({Month={'$(=Max(Month,2))'}>} Sales)

View solution in original post

1 Reply
swuehl
MVP
MVP

You can specify the rank as second parameter to max() function.

max(Month,2) will return the second highest Month

So maybe use something like

Sum({<Month={'$(=Max(Month))'}>} Sales) / Sum({Month={'$(=Max(Month,2))'}>} Sales)