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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
mike_garcia
Specialist
Specialist

Inverse Ranking

Hello Everyone,

I have the requirement to rank certain values in a straight table in reverse order. That means if I have, for example, Sales values from 1 to 10, the function rank(sum(Sales),3,1) will retrun 1 for the greatest sales and 10 for the lower sales. I want it to return 1 for the LOWEST Value and 10 for the greatest Value.

I hope somebody can help me out.

Thanks!

Miguel García
Qlik Expert, Author and Trainer
Labels (1)
1 Solution

Accepted Solutions
Not applicable

Hi

I suppose your sales are positive, so just use : rank(-sum(Sales))

jj

View solution in original post

5 Replies
sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi Mike,

if u want reverse order thats what u r using rank?

then better try Strainght table ->Properties->sort

i think it ll help for u

-Sathish

mike_garcia
Specialist
Specialist
Author

Thanks, but thats not what Im looking for. I need to assign a ranking to every row in the straight table, no matter the sort order.

Miguel García
Qlik Expert, Author and Trainer
Not applicable

Hi

I suppose your sales are positive, so just use : rank(-sum(Sales))

jj

mike_garcia
Specialist
Specialist
Author

Thank you!!!! That was it... I appreciate your help.

Mike

Miguel García
Qlik Expert, Author and Trainer
stuwannop
Partner - Creator III
Partner - Creator III

This is probably just a syntax thing but what if the formula was slightly more complex: i.e.

=

rank((count(DISTINCT{$<OPPStatus ={'Open'},OPPSalesStage = {'5 - Confident','6 - Committed'},Dim_SPECFlag= {'1'}>}opportunityid))/

(
count(DISTINCT{$<OPPStatus ={'Open'},Dim_SPECFlag = {'1'}>}opportunityid)))

No need to worry too much about the set analysis but I want the same result as the original poster but I'm using count and dividing two numbers together - any ideas?

Thanks

Stu