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

second max value

Hi!

Do i have to sort my tables in order to get the second next highest date for example? or is it another way?

1 Solution

Accepted Solutions
SunilChauhan
Champion
Champion

max(filedname,2)

hope this help

Sunil Chauhan

View solution in original post

7 Replies
Not applicable
Author

Hi,

if you want highlight that you can use some one of the "rank" function in your table.

C u,

Stefano

SunilChauhan
Champion
Champion

max(filedname,2)

hope this help

Sunil Chauhan
Anonymous
Not applicable
Author

sorry that's not what i'm looking for. i have to be able to use it in an expression i order to compare max and second max value.

Not applicable
Author

Why don't use two max together?

something like this: max(filedname,2) + max(filedname) in combination with aggr function also.

C u,

Stefano.

SunilChauhan
Champion
Champion

see the attached file

hope this helps you

Sunil Chauhan
Anonymous
Not applicable
Author

Hi guys.

You we're right, i was wrong. Max(date,2) worked perfectly! (i didn't have enough data to do it, that was it)

sorry for troubling you!

Thanks!

andriesb
Creator II
Creator II

max(filedname,2) does work indeeed, but I'm looking for a neat and easy solution in an expression the show all values >= the 12th last values : e.g. in an overvue show the values for the last 12 months.

This will do the trick = {'>=$(=Max(fieldname, 12))'} if there are more than 12 values available, but fails of there are only 4 values. It shows nothing...

Expression is = sum( {$< period = {'>=$(=Max(period,12))'} >} valuename )

I've came up with a solution to extra calc all distinct values and use the min() :

= sum( {$< per = {'>=$(=Max(period, min(count( distinct period), 12) ))'} >} valuename ) , but maybe there another easier solution?