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: 
sasikanth
Master
Master

Tricky Aggregation in top 10 Values

Hello Guys here i have a special requirement ,

I have the following fields

ID , country, region, Cust_cd and year, Sales

Here i want to calculate top 10 customers vs Other customers based on year and country

my formula is

=sum({<Cust_cd={$(=concat(if(aggr(rank(sum(sales),4),cust_cd)<=10,chr(39)&Cust_cd&chr(39)),','))}>}Sales)

and in a bar chart i am taking year and Country as Diemensions ,

when i made any selections on seperate list boxes country and year , then only it is giving correct values,

if i did not select any value then it is showing some other values ,

the problem i have identified is when taking top 10 cust_cd , for the first time it is taking based on total COUNTRY field,

if you select a specific country then only it is showing top 10 values in that country,

as i am taking country as dimension , the chart has to show top 10 valeus accordingly ,

can you guys please help in sloving this problem , please let me know where i am doing mistake ...

Thanks

Sasi

11 Replies
djsampat
Creator II
Creator II

View attached sample. Replace the inline data with more lines if necessary or replace the Company and Region with familiar names.

Top 3 Sales by Region Sample - Inline

djsampat
Creator II
Creator II

Why don't you try limiting the Dimension by Largest 10 and the expression is the Region Sales only.

If this helped you, please mark as Helpful. If it solves your issue, please mark as Answer

Regards

Dhruv