Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
samnoor_27
Contributor
Contributor

Understanding Rank in KPI

Hi,

I wish to understand how the Rank function actually works.

In the table "Ranking" in attachment, I wish to get the top 5 Organization and displays the count of the top 5 in a KPI object.

My set analysis to get the top 5 and compute the total number of Tickets is as follows:

=Count({<Organization = {'=Rank(Count(Ticket))<= 5' }>}Ticket)

Logically I should be getting 10 as result (3+2+2+2+1), but I fail to understand why the set analysis returns 9!

FYI: top 2 to top 13 results in 9

As from top 14, result is 31

Thanks to advise on this issue

 

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

You can try to use this

=Count({<Organization = {'=Rank(Count(Ticket), 4) <= 5' }>}Ticket)

View solution in original post

12 Replies
JordyWegman
Partner - Master
Partner - Master

Hi,

The problem lies in using Organization in your set analysis. Replace this by Ticket and it will work:

=Count({< Ticket = {'=Rank(Count(Ticket))<= 5' }>}Ticket)

Jordy

Climber 

Work smarter, not harder
samnoor_27
Contributor
Contributor
Author

Hi @JordyWegman ,

Thanks for your reply. I'm afraid this time it returns me total count of the 26 Organizations, which is 31.

Kind Regards,

JordyWegman
Partner - Master
Partner - Master

Then we'll try something else. Is the count of organizations equal to the count of tickets? Try to add Count(Organization) to your table and see if they match with Count(Ticket).

If it's the same, then you could use this:

=Count({< Organization = {'=Rank(Count(Organization))<= 5' }>}Organization)

Jordy

Climber 

Work smarter, not harder
tresesco
MVP
MVP

Could you share your sample app that demonstrates the issue? 

samnoor_27
Contributor
Contributor
Author

Hi @tresesco ,

Please find attached the qvf as well as excel file.

Thanks for your help!

samnoor_27
Contributor
Contributor
Author

Hi @JordyWegman ,

Yeah we can say Count(Organizations) equals to Count(Tickets), but unfortunately still not getting the desired result :(..

Don't you think it has something to do with how Qlik uses the function Rank?

 

Kind Regards,

tresesco
MVP
MVP

When you use rank<=5, then it considers till 4th row of your table. And that is because when you see a rank 5-26 it's a dual value which has a number at the backend as 13.5 (use num() around your rank(), you would see that).

Capture.PNG

Hope this clarifies

samnoor_27
Contributor
Contributor
Author

Hi @tresesco ,

Thanks for your explanation.

Ok...it kind of makes sense..

But does it mean, I can't compute and display the count for top 5 Organization to return 10? Or is there an alternative for that?

Kind Regards,

sunny_talwar

You can try to use this

=Count({<Organization = {'=Rank(Count(Ticket), 4) <= 5' }>}Ticket)