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

How to select second maximum value

Hi

  We have list of years followed by

2014

2013

2012

2011

We want compare 2014 and 2013.how to select second maximum value from

  Kindly advise me

11 Replies
tresesco
MVP
MVP

Max(Field, 2)         // '2' is the rank

Anonymous
Not applicable
Author

hi

Thanks,

but it not working.This is my expression

"If(Year=Max(Year,2),Year,(Sum(HWB_WT/1000)+Sum(VOLUME_IN_TEUS)))"

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Create a variable and put =max(Year,2) there, and then use the variable in your if statement.

"If(Year=variable,Year,(Sum(HWB_WT/1000)+Sum(VOLUME_IN_TEUS)))"

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
tresesco
MVP
MVP

Max( ,2) is fine. The issue is how and where you use it. Is it a chart or text box? If chart, what are the dimensions..., so many questions ! Better, try to share your sample qvw.

Anonymous
Not applicable
Author

hi

still same issue.it is not working

its_anandrjs

Did you try this

If(Year = Max(Year)-1,Year,(Sum(HWB_WT/1000)+Sum(VOLUME_IN_TEUS)))

Anonymous
Not applicable
Author

yes,

but not working anand.

SunilChauhan
Champion
Champion

try this

let vmax2=Max(Year,2);

if( Year=$(vmax2),Year,(sum(HWB_WT/100))+sum(VOLUME_IN_TUES)))

or attched sample

hope this helps

Sunil Chauhan
Anonymous
Not applicable
Author

Hi,

Sorry this is not working.

how to compare current and previous year value.