Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
garyvary123
Contributor III

Bottom 10 Values Using Rank Function

Hi guys, new to Qlik Sense and just stumbled upon a problem. I'm trying to get the top 10 and bottom 10 values for my table (In this case the variable 'Combined'). I was able to get the top 10 by using the rank function below: 

 

if(rank(avg({<[Company]={'Comp'}>} ([Combined])))<=10,avg({<[Company]={'Comp'}>} ([Combined])),null())

 

I tried to get the bottom 10 by using the following:

 

if(rank(avg({<[Company]={'Comp'}>} ([Combined])),mode(4))<=10,avg({<[Company]={'Comp'}>} ([Combined])),null())

 

However this didn't work. I may be using the mode function wrong? Would appreciate some help. Thanks!

1 Solution

Accepted Solutions
rubenmarin

Hi, you can try adding a minus to the avg:

if(rank(-avg({<[Company]={'Comp'}>} ([Combined])))<=10,avg({<[Company]={'Comp'}>} ([Combined])),null())

View solution in original post

2 Replies
rubenmarin

Hi, you can try adding a minus to the avg:

if(rank(-avg({<[Company]={'Comp'}>} ([Combined])))<=10,avg({<[Company]={'Comp'}>} ([Combined])),null())

garyvary123
Contributor III
Author

Worked like a charm! Thanks!