Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Nested Rank Function

Hi All,

We are using Qlik Sense April 2018 version.

We  have a business requirement on rank function.In my qvd i have Emp Name,Sales Value and Revenue value.I want calculate the Rank of Employee first based on Sales Value and then on Revenue .If the Sales value of two employees are same then it should check for revenue value and then calculate the final rank for the employee.

Please find the below example.

     

CCSalesRevenueRank(sum(Sales))Rank(sum(Revenue))Final Rank(If sales rank is same then check for revenue rank)
AA50003000111
BB40001500233
CC40002000222
DD30001000344

Please help me to resolve this issue.

Thanks,

Duryodhan

4 Replies
sunny_talwar

May be this

Rank(RangeSum(Sum(Sales), Sum(Revenue)/1E10))

sunny_talwar

Sample image and file attached

Capture.PNG

rangam_s
Creator II
Creator II

Check this app.

if(SubStringCount(Rank(Sum(Sales)),'-')>=1,Rank(Sum(Revenue)),Rank(Sum(Sales)))

rangam_s
Creator II
Creator II

or this,

if(SubStringCount(','&Concat(Total (Aggr(Rank(Sum(Sales)),CC)),',')&',',','&Rank(Sum(Sales))&',')>1,Rank(Sum(Revenue)),Rank(Sum(Sales)))