Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Top N customers not displaying top n but all teh results.

Hi All,

I want to display the top 250 customers using pivot table I have used an expression below :

if(aggr(rank(Sum(Total_Amt)),Customer_Mailing_Name,Customer_Address_Line_1,Customer_City)<=10,Sum(Total_Amt))

I am not sure if I have to add the above expression as calculated dimension or as an expression.

And also the above expression returns me all the customers does not limit to 250 which is my concern.

Please help in this issue.

Thanks,

Swetha



32 Replies
sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi please find the attachements.

lIKE WISE U WANT?

-sATHISH

Not applicable
Author

Hi,

Firstly you should use it as an expression. But remember that if you use more expressions in your chart, without limitation, that it will show all of the results (maybe you do like that). Moreover, try to sort by top 250 customers, than you will see if it's correct.

For example for my top 20, I use:

IF ( Aggr ( Rank ( Sum({$<CalendarYear={$(=Max(CalendarYear)-1)}>}InvoiceAmount)) , Klantnaam) <= 20, Sum({$<CalendarYear={$(=Max(CalendarYear)-1)}>}InvoiceAmount) )

Good luck!

Not applicable
Author

Hi,

The calculated dimension is almost correct. The mistake is that you should just switch "if" and "aggr" within your formula:

=Aggr(If(Rank(Sum(Total_Amt)),Customer_Mailing_Name,Customer_Address_Line_1,Customer_City)<=250,Customer_Mailing_Name,Customer_Address_Line_1,Customer_City)

BG