Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rank & Aggregation Question

I'm trying to calculate a rank from the Rating column that is aggregated over Date, Time and Location fields.

This is my current table where Rank = rank(TOTAL(Rating),0,1)

DateTimeLocationNameRating
Rank
2017-06-2513:00LondonMatt1234
2017-06-2513:00LondonTim1225
2017-06-2513:00LondonBob1216
2017-06-2415:00LondonFrank1561
2017-06-2415:00LondonJim1422
2017-06-2415:00LondonPat1343

What I need to achieve is:

DateTimeLocationNameRating
Rank
2017-06-2513:00LondonMatt1231
2017-06-2513:00LondonTim1222
2017-06-2513:00LondonBob1213
2017-06-2415:00LondonFrank1561
2017-06-2415:00LondonJim1422
2017-06-2415:00LondonPat1343

I've tried using rank and aggr but just cannot get it to work.

Any help appreciated.

Thanks

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Aggr(Rank(Sum(Rating)),Date,Time,Name)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

5 Replies
Kushal_Chawda

try this

rank(TOTAL <Date> only(Rating),0,1)

antoniotiman
Master III
Master III

Hi Matthew,

maybe remove Total from Expression

Regards,

Antonio

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Aggr(Rank(Sum(Rating)),Date,Time,Name)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

Thanks, but that returns Rank as 1 for all rows,

Anonymous
Not applicable
Author

Thanks, that worked