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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
KPage
Contributor III
Contributor III

Only Show top 10 sales

Hi-

I am looking only to show the top 10 items by sales. I have tried using Limitation on a dimension, but it does not work for some reason. Is there another formula I can add something to this expression below? (This is my Sales expression):

 

Sum({<[Week Ending]={'$(=Max([Week Ending]))'}>}[Retail Sales])

 

Here is a screen shot, I only want the top 10 to show

KPage_0-1694011298762.png

 

Thank you!

Labels (3)
1 Reply
daturpin
Partner - Creator II
Partner - Creator II

You should be able to use the Rank function to get what you want.

Your expression returns all sale sums:

Sum({<[Week Ending]={'$(=Max([Week Ending]))'}>}[Retail Sales])

Make that

Rank(Sum({<[Week Ending]={'$(=Max([Week Ending]))'}>}[Retail Sales]))

To return the sales Rank, then put that in an IF to return the original values IF the rank is <11:

=If(Rank(Sum({<[Week Ending]={'$(=Max([Week Ending]))'}>}[Retail Sales])) <=10, Sum({<[Week Ending]={'$(=Max([Week Ending]))'}>}[Retail Sales]))

Does that work?

Also look into the Rank documentation because there are some caveats on how the Rank function works; you might find you are getting more than 10, if for example you have two items that are tied.

https://help.qlik.com/en-US/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/ChartFunctions/Ra...