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: 
Not applicable

Rank Function

Hi Everyone,

I am working on selecting the highest performer in a certain type of sport. So, I need my text object to return a name for the highest number of scores, and currently the expression is

= only({<Sportsman={"=rank(sum([Total Number of Points Scored], Sportsman)=2"}>} Sportsman),however it doesn't work and only returns a '-'. Can anyone help with this please?

Thank you,

Anna

Labels (1)
12 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try =FirstSortedValue(Sportsman,-aggr(sum([Total Number of Points Scored]),Sportsman)) for the name of the sportsman with the highest score. For the second highest use =FirstSortedValue(Sportsman,-aggr(sum([Total Number of Points Scored]),Sportsman),2)


talk is cheap, supply exceeds demand
swuehl
Champion III
Champion III

There is a closing bracket ) missing in your advances search expression and I think you should remove the second argument from the rank() function:

= only({<Sportsman={"=rank(sum([Total Number of Points Scored]))=2"}>} Sportsman)

Not applicable
Author

Thanks, Gysbert, that worked for the highest one. What about the lowest?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

remove the - character in front of the aggr.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you!

Not applicable
Author

what if I want to list all sportsmen that have the same highest value?

tresB
Champion III
Champion III

In that case try with concat() function like:

= Concat({<Sportsman={"=rank(sum([Total Number of Points Scored]))=2"}>} Sportsman, ',')

Not applicable
Author

thank you for that. and the case for listing all sportsmen that have the same lowest value?

tresB
Champion III
Champion III

This?

= Concat({<Sportsman={"=rank( - sum([Total Number of Points Scored]))=1"}>} Sportsman, ',')