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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
AndersGS
Contributor III
Contributor III

Filter straight table based on nth largest Dimension value

Hi,

I have a Straight Table in QlikView in which I want to display only the nth largest value in a Dimension.
The dimension I want to evaluate is GroupCode which I also need to add an if statement to, CY_PY = 1.

What I would like to see is for example the second largest GroupCode and its corresponding Expression Value:

GroupCode      GroupCodeName         Expression Value
981                       Name9                             43 282

My data looks like this:

lbl2.PNG

Using QlikView 11.20 SR18

 

Thanks for your help
Anders

Labels (1)
1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this in your expression:

if(aggr(RANK(AGGR(SUM(if(CY_PY=1,[sum(LAGANTTILLG)])),GroupCode)),GroupCode)=2,sum(if(CY_PY=1,[sum(LAGANTTILLG)])),NULL())

View solution in original post

7 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

There you go:

In expression, try this:

IF(AGGR(RANK(AGGR(SUM(Value),GroupCode)),GroupCode)=2,sum(if(CY_PY=1, Value)),NULL())

MC.PNG

AndersGS
Contributor III
Contributor III
Author

Thanks for your suggestion! I have just tried it but doesn't seem to be working. This is what I'm using:

=IF(AGGR(RANK(AGGR(Sum(LAGANTTILLG),GroupCode)),GroupCode)=2,sum(if(CY_PY=1,LAGANTTILLG)),NULL())

The GroupCode dimension contains both text and numbers, could that be a problem here?

Regards

Anders

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

You have a sample app?

 

AndersGS
Contributor III
Contributor III
Author

Here you go

AndersGS
Contributor III
Contributor III
Author

Sure, here you go! 

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this in your expression:

if(aggr(RANK(AGGR(SUM(if(CY_PY=1,[sum(LAGANTTILLG)])),GroupCode)),GroupCode)=2,sum(if(CY_PY=1,[sum(LAGANTTILLG)])),NULL())

AndersGS
Contributor III
Contributor III
Author

Works fine, thank you!