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: 
Jokeynsi
Contributor
Contributor

Sum with rank and aggr works in table but not in a KPI

Hi All,

Currently I have a data set with 2 dimensions and one sales amount. I'm trying to get a sum of the top 10 games per year. I've managed to do this in a table by using the following expression:

If(
Rank(Aggr(Sum(_Turnover), Game, Year), 4, 1)
<= 10
, Sum(_Turnover)
)

 

Now my problem is that I'm trying to get this sum into a KPI and this will break the expression (removing the dimension year and game from the table will break it). I'd like to compare all sales versus top 10 games per year sales. Haven't managed to get this working yet. Any ideas? 

1 Reply
MayilVahanan

HI @Jokeynsi 

Try like below

Sum(Aggr(If( Rank(Sum(_Turnover), 4, 1) <= 10, Sum(_Turnover)), Game, Year))

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