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

Problem with Rank Function, Column Order

Please see attached. The Rank() function returns the data I want to see as long as it's in the second (or greater) column position in the chart. If I move it to the first column position, it fixes the sort order in an undesirable fashion and I can't restore it. (Specifically it shows 10 through 1 in descending order when re-sorted, but not 1 through 10 as desired.)

The attachment uses the QlikView provided sample sales data.

Thanks.

BONUS QUESTION: How can I get the Total to show the total of only the values shown (Top 10 versus the whole set)?

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Remove the dimension limit

Replace the dimension Customer with

     =if(aggr(rank(sum(Sales)),Customer)<=10,Customer)

1.png

View solution in original post

6 Replies
trdandamudi
Master II
Master II

Please see the attached file and hope this resolves your issue...

MK_QSL
MVP
MVP

Use this for Rank

=Num(Rank(Total Sum(Sales),4))

For Total Sales u can use

SUM(Total Sales)

SUM(Sales)/SUM(TOTAL Sales) will give you % to Total Sales for each Customer.

maxgro
MVP
MVP

Remove the dimension limit

Replace the dimension Customer with

     =if(aggr(rank(sum(Sales)),Customer)<=10,Customer)

1.png

Not applicable
Author

Thanks. That seems to work except re-sorting the sales eventually brings up sales from the bottom. The total as Sum of Rows works better.

Not applicable
Author

Thank you. Initially gives good values, but re-sorting doesn't work very well.

Not applicable
Author

This works best and re-sorting works as expected. The NULL value even works as a rollup of "Others" but is easily suppressed. Thank you!