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

Top n values according to the selected criteria in pivot table

Hi All,

I am trying to get top n values say 20 for a selected criteria in a pivot table like Top 20 companies by spend in that specific region.

Can some one help me please?

Thanks.

2 Replies
SunilChauhan
Champion
Champion

Create an  like below

Load * inline

[

Columnname

top1

top2

top3

top4

.

.

.

]

and in chart _>properties->presentation->max Number shown

if(Columnname='top1',1,if(Columnname='top2',2,if(Columnname='top3',3)))

U can add more as per need.

Thanks

Sunil

Sunil Chauhan
Not applicable
Author

Expression:

aggr(if(rank(sum(sales)) <= vTopRanking,rank(sum(sales))),Year,Customer)

vTopRanking is a variable so you can get the top 10, 15, or any number you type in.

Year is the dimension and the pivot tables columns and Customer (also a dimension) is what I am aggr on.

hth,

Stephen