Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Partner - Creator II
Partner - Creator II

Using qsVariable extension to get Top 10 and Bottom 10 values of a bar chart

Hi - wondering if anyone have any thoughts on the approach of my problem.

I want to have my bar chart render on a click of a button to show me 'Top 10' and 'Bottom 10' values based on my 'sales' and 'account' columns. 

Capture1.PNG

I have my syntax ready and believe they should be placed in the actual button section:

Top 10 = 
sum({<Account={"=Rank(Sum(Sales))<=10"}>} Sales)

Bottom 10 = 
SUM({<Account = {"=Rank(-SUM(Sales)<=10"}>}Sales)

Capture2.PNG

My confusion - on the below image, I am not sure how this linkage is created given that I can only tie this qsVariable extension to one variable (vTopBot).

Capture3.PNG

I am also unsure what I am supposed to define within my given variable in order to produce the top and bot 10 values for my chart. Any help would be greatly appreciated

Labels (4)
4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In your bar chart, make your Measure

=$(vTopBot)

In your Top10 button, assign the value (note the single quotes)

='sum({<Account={"=Rank(Sum(Sales))<=10"}>} Sales)'

to the vTopBot variable.  Do the same for the Bottom 10 button. 

You can also get clever and make your chart measure:

=sum({<Account={"=$(vTopBot)Rank(Sum(Sales))<=10"}>} Sales)

and use the buttons to assign '' or '-' to the vTopBot.

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

dreweezy
Partner - Creator II
Partner - Creator II
Author

Not sure why I wasn't getting any notifications so I have asked this question again thinking my post never went through. I followed your advice but am getting the same values. 

Capture1.PNG

Capture22.PNG

123.PNG

I placed the variable $(vTopBot) into the measure of the bar chart, but still having trouble getting results as expected. Here is a snip of what my vTopBot variable is defined as which I believe may be causing the problem?

6223.PNG 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you failed to put the single quotes around the values?

Note that the buttons will not change the variable values, but it will not change the visible value in the variable overview dialog.

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

mbjallow6
Contributor III
Contributor III

Hello Everyone! I have a similar problem. i am using qsVariable input. i have a field name Amount in USD, my question how would i use the < or > plus an input value to display the corresponding correct data. thank you advance.