Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Partner - Creator II
Partner - Creator II

Syntax correction for my rank calculation

This is a follow up from my previous thread. I now fully understand how the qsVariable works and now have it set up so that I want to show the Top 10 and Bottom 10 values in a bar chart given my dimension. I also found the Qlik community refers this to as Cyclic Dimension, but please correct me if I am wrong. My syntax is not working although I feel that it is very close. 

Dimension: ACCOUNT

Value: SALES

Variable: vTopBot (1 = top 10, 2 = bottom 10)

Syntax under measure is:

if('$(vTopBot)'=1,Sum({<ACCOUNT={"=Rank(-Sum(SALES))<=10"}>},
if('$(vTopBot)'=2,Sum({<ACCOUNT={"=Rank(-Sum(SALES))<=10"}>})
))

Any help would be greatly appreciated.

 

Labels (2)
2 Replies
Channa
Specialist III
Specialist III

=If(Aggr(Rank(Sum(SALES)),Account)<=10,Account)

 

for top 10 it is ur dimension

 

=If(Aggr(Rank(-Sum(SALES)),Account)<=10,Account)

bottom 10

Channa
pradosh_thakur
Master II
Master II

if($(vTopBot)=1,Sum({<ACCOUNT={"=Rank(-Sum(SALES))<=10"}>},
if($(vTopBot)=2,Sum({<ACCOUNT={"=Rank(-Sum(SALES))<=10"}>})
))

or

if($(vTopBot)=1,Sum({<ACCOUNT={"=$(=Rank(-Sum(SALES)))<=10"}>},
if($(vTopBot)=2,Sum({<ACCOUNT={"=$(=Rank(-Sum(SALES)))<=10"}>})
))

You need to check what your dimension are if the dimensions for the measures are different then the chart dimensions

Learning never stops.