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: 
Sebastian_Dec
Creator II
Creator II

Differences in top 50 values

Hello, please help, for some reason, sometimes when calculating the TOP 50 values there are differences between the KPI and the table. Differences sometimes occur and sometimes not.

My KPI function:

 

=(Sum({$<wartosc_paf = {"=Rank(sum(wartosc_paf), 4) <51"}>} wartosc_paf))*-1

 

My table function:

 

Sum(wartosc_paf)*(-1)

 

Of course I have it turned on Fixed number Bottom 50:

Sebastian_Dec_0-1699342699666.png

Data for November:

Sebastian_Dec_1-1699342779223.png

 

Data for January:

Sebastian_Dec_2-1699342823472.png

 



Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.
Labels (5)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

The KPI function doesn't work. Rank() cannot be used unless you have a dimension. Rank() is always 1 if you don't have a dimension.

Also, the set expression should make a selection in the dimension that you want to rank, not in the number that you sum. I.e.

... <kod_artykul = {"=Rank( ...
instead of
... <wartosc_paf = {"=Rank( ...

Try the following instead

Sum(Aggr(Sum({$<kod_artykul = {"=Rank(sum(wartosc_paf), 4) <51"}>} wartosc_paf)*-1 ,kod_artykul))

View solution in original post

2 Replies
hic
Former Employee
Former Employee

The KPI function doesn't work. Rank() cannot be used unless you have a dimension. Rank() is always 1 if you don't have a dimension.

Also, the set expression should make a selection in the dimension that you want to rank, not in the number that you sum. I.e.

... <kod_artykul = {"=Rank( ...
instead of
... <wartosc_paf = {"=Rank( ...

Try the following instead

Sum(Aggr(Sum({$<kod_artykul = {"=Rank(sum(wartosc_paf), 4) <51"}>} wartosc_paf)*-1 ,kod_artykul))

Sebastian_Dec
Creator II
Creator II
Author

wow, thank you so much @hic .

Yes, that solved my whole problem. Now I will know how to use the Rank function correctly.

Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.