Qlik Community

Qlik Sense Cloud Discussions

rgreben
New Contributor III

Top 5 Using a Variable in Qlik Sense

Hello Group!

I would like to show Top 5 accounts based on Sales $ Growth. Attached are the fields I am using in my table. Sales $ Growth is a variable. The variable name is vNetSalesYTDGrowth$. What formula would I use?

Thank you.

1 Solution

Accepted Solutions
rgreben
New Contributor III

Re: Top 5 Using a Variable in Qlik Sense

Thank you so much. The formulas work as intended. Appreciate the quick response.

4 Replies
MVP & Luminary
MVP & Luminary

Re: Top 5 Using a Variable in Qlik Sense

You could use a calculated dimension like so:

Aggr(if(rank($(vNetSalesYTDGrowth$), 4,1) < 6, Account), Account)

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Highlighted
rgreben
New Contributor III

Re: Top 5 Using a Variable in Qlik Sense

Thank you for your response. What about the Bottom 5?

MVP & Luminary
MVP & Luminary

Re: Top 5 Using a Variable in Qlik Sense

Add a minus operator to the value you are ranking. 

Aggr(if(rank(-$(vNetSalesYTDGrowth$), 4,1) < 6, Account), Account)

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

rgreben
New Contributor III

Re: Top 5 Using a Variable in Qlik Sense

Thank you so much. The formulas work as intended. Appreciate the quick response.