Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need Rank on Sum of Ranks

I have 4 columns that I am using to create ranks from other measures:

For the 4 columns I am using the below expression:

Aggr(

Rank(

$(variable)

4,1),

Rep)

I then add the 4 columns together with the below expression into "Sum of Rank"

Column(6) + Column(7) + Column(8) + Column(9) (stored in variable "Sum_of_Rank")

Then, in the column "Final Rank", I am attempting to rank on the "Sum of Rank" with the below expression.

Aggr(

Rank(

$(Sum_of_Rank),

4,1),

Rep)

However, this is not working. I believe the problem is traced back to the Columns being added in the measure. Any ideas? Some data below

 

QTD Power RankingQTD Power Ranking QoQQTD Power Ranking QoQ%QTD PTQ RankingSum of RankFinal Rank
4441325-
7662948-
141616248-
2313131564-
2555365-
13994172-
5885879-
628281981-
2120203495-
3025251696-
329293899-
1 Solution

Accepted Solutions
sunny_talwar

Well, you cannot really use Column reference within the Aggr() function... you need to use the exact expressions

View solution in original post

8 Replies
sunny_talwar

May be try without dollar sign expansion

Aggr(

Rank(

Sum_of_Rank,

4,1),

Rep)

Anonymous
Not applicable
Author

Hi Sunny, thats not working, I added the formula in the variable directly to the expression and it still does not work. See below.

Aggr(

Rank(

Column(6) + Column(7) + Column(8) + Column(9),

4,1),

[Rep])

sunny_talwar

Well, you cannot really use Column reference within the Aggr() function... you need to use the exact expressions

Anonymous
Not applicable
Author

Ok, thanks. thats the problem. In place I pasted in all the expression from the 4 columns and that worked. Thanks so much Sunny!

Anonymous
Not applicable
Author

Sunny,

I added all the expressions togther from those columns like you suggested and it seems to be working. However, I actually want to do the reverse ranking. For example:

the numbers for 4 ranking columns are 4+4+5+13 which equals a sum of rankings of 26, which is the lowest sum of all the corresponding ranking columns, and therefore has the best Power Ranking.

on the flip side: 127+130+132+104=493 has highest sum of all the corresponding ranking columns, and therefore has the worst Power Ranking.

However, this PowerRankning expresion below is ranking based on the hihest number, so therefore 493 is the 1 ranking while 26 is 135. I want to flip this around.

Aggr(

Rank(

Aggr(Rank($(vGSPRanking_Current_FY_QTD_Sales),),[Rep])

+

Aggr(Rank($(vGSPRanking_Current_FY_QTD_Sales)-$(vGSPRanking_Prior_YQTD),4,1),[Rep])

+

Aggr(Rank(($(vGSPRanking_Current_FY_QTD_Sales)-$(vGSPRanking_Prior_YQTD))/$(vGSPRanking_Prior_YQTD),4),[Rep])

+

Aggr(Rank(sum([Shipped])/Sum([Quota])*$(=$(vExp_Pct_CurrQtr_TD)),4),[Rep]),

4,1,),

[ Rep])

Any ideas?

sunny_talwar

May be add minus sign in front of all your expressions or multiple the sum by -1

Anonymous
Not applicable
Author

That worked! thanks!

sunny_talwar

Awesome