Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Creator II
Creator II

Syntax for using qsVariable to render chart based on button

Hi, I believe my previous thread was never uploaded. I am trying to grab the top 10 and bottom 10 values using the qsVariable.

Capture23.PNG

Inside my variable for the top and bottom 10 I have:

Capture.PNG

I am trying to enter a syntax (using probably if statement) so that my bar chart will render based on when a user selects one of the buttons. 

I have something like but doesn't seem to work. 

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

2 Replies
R_Kaymakchiev
Contributor III
Contributor III

Hi,

have you tried instead  of doing nested if statement, just a single one ?

The code should be something like this:

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

Channa
Specialist III
Specialist III

i have similar post answered search for 

 

qsVariable to render chart based on newly created buttons

Channa