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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rank Help

Afternoon folks,

I have the below table in my Qlikview app, and I am trying to add a Rank Column to the far left of it. How do I write a rank expression for this table that ranks the data by the success % (high to low), then by # of docs (again high to low) and then by Site Code (A-Z) so that I achieve the visible ranking in the ranking column below:

RankSite CodeSite Name# of DocsFailureSuccessOtherTotalSuccess %
1BB10580105711058100.00%
2JJ1360404100.00%
3CC94026883391297.14%
4AA7097326596225631394.82%
5GG37126142317184.52%
6FF38137201824684.45%
7EE57850188023878.99%
8DD74351189324378.75%
9HH1790000-
10II17200000-

I have googled how to do this but can't actually find the method I'm looking for.

Thanks,

Gareth

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Not sure Gareth.... very difficult to say without having a look my friend

You can check the expression we are ranking and try to adjust the weights

RangeSum(

([Success]

/

([Success] + [Failure]))*100000,

Total/1E5,

-Rank(TOTAL [Site Code]/1E10))

Make sure you see this with a lot of 0s after decimal point. Something like this

Capture.PNG

View solution in original post

12 Replies
Clever_Anjos
Support
Support

Wich expression is "Success %" ?

Anonymous
Not applicable
Author

Success % is "Success / (Success + Failure)"

Thanks

sunny_talwar
MVP
MVP

Would you be able to share a qvw sample to look at this?

Clever_Anjos
Support
Support

and "Success" and "Failure"?

Anonymous
Not applicable
Author

Hi,

QVW Sample attached.


Thanks,

Gareth

sunny_talwar
MVP
MVP

May be this

Rank(TOTAL

RangeSum(

[Success]

/

([Success] + [Failure]),

[# of Docs]/1E5))

Anonymous
Not applicable
Author

Thanks Sunny,

Almost there with!

When I amend the expression to suit my business' real life app, I'm getting a few anomalies as you will see from the attached Excel file.

Firstly, Rank 1 shouldn't be NMO, but ESX.

Also, where there are sites with the same score and number of docs, they aren't being given an individual ranking (which is what I was trying to get using the sort by name as the third sort criteria).

The expression I'm using is


Rank(TOTAL

RangeSum(

Count({<[FTMR_P2P_KPI]={"Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])

/

(Count({<[FTMR_P2P_KPI]={"Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number]) + Count({<[FTMR_P2P_KPI]={"Failure"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])),

Count({<[FTMR_P2P_KPI]={"Failure","Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])/1E5))

Any ideas?


Many thanks again.

Gareth

sunny_talwar
MVP
MVP

Try this

Rank(TOTAL

RangeSum(

Count({<[FTMR_P2P_KPI]={"Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])

/

(Count({<[FTMR_P2P_KPI]={"Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number]) + Count({<[FTMR_P2P_KPI]={"Failure"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])),

Count({<[FTMR_P2P_KPI]={"Failure","Success"},[Purchase Order Document Type - Code]-={''} >} Distinct [Invoice Number])/1E8,

-Rank(TOTAL [Site Code])/1E10))

Anonymous
Not applicable
Author

So close.

The sorting on the score is correct now, it's just some of the ranking is showing as a 7-11 where the scores are the same. Is there anyway of splitting this down to 7, 8, 9, 10, 11?

Thanks,

Gareth