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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Braveen
Contributor III
Contributor III

Rank based on two columns and should not change when filter is applied

Hi,

I am trying to create a rank based on Zone, ID and Metric 1 which should not change when ID filter is applied.

Braveen_1-1684758366341.png

Like say I filter for  4, Rank should not change.

Braveen_2-1684758414079.png

I have created the rank using below expression;

aggr(rank(sum([Metric 1])), Zone, ID)

But, rank is recalculated based on the filtered values. Would appreciate if you could share your inputs.

- Braveen

 

 

Labels (1)
  • SaaS

7 Replies
Chanty4u
MVP
MVP

Try this 

Rank(Total sum([Metric 1]), Zone, ID)

 

Braveen
Contributor III
Contributor III
Author

@Chanty4u Thanks for the suggestion. This expression ranks the ID but disregarding the Zone (Rank starts as 1 and ends at 6) , also when I apply filter, rank is recalculating.

I need the rank of the ID within the zone based on the Metric 1 and should not change when I apply the ID filter. 

Kushal_Chawda

@Braveen  Just exclude the selections of your dimensions you have used in aggr function

 

aggr(rank(sum({<Zone=, ID=>}[Metric 1])), Zone, ID)

Braveen
Contributor III
Contributor III
Author

@Kushal_Chawda It is broadly grouped like 1-20 or 1-10 as the rank for all 10/20 records. 

Kushal_Chawda

@Braveen  don't understand this statement. Basically in my previous post I have provided you solution to not change the Rank based on selection

Braveen
Contributor III
Contributor III
Author

@Kushal_Chawda   This is how it looks

Braveen_0-1684910255846.png

 

Kushal_Chawda

@Braveen  Your Ranking will be based on State so you need to include state in Aggr instead ID. If you add more dimension in table eg. ID..exclide the selection of that as well in Set(don't include it in aggr)

aggr(rank(sum({<Zone=, State=>}[Metric 1])), Zone,State)