Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Partner - Creator II
Partner - Creator II

Creating 2 buttons for top 10 and bottom 10 values

I have downloaded the qsVariable extension and have my buttons created for 'Top 10' and 'Bottom 10'. I also have a variable named 'vTopBot' with the value 2 in it so that it is linking to the 2 buttons (1 for Top 10 and 2 for Bottom 10). 

In order to get my top 10 and bottom 10 my syntax is as follows:

top 10:

    SUM({<$vTopBot= {"=1, (SUM(invoiceTotal),)<=10"}>}invoiceTotal)

bottom 10:

    SUM({<$vTopBot= {"=1, (-SUM(invoiceTotal),)<=10"}>}invoiceTotal)

 

I am positive syntax is off because I am unable to display any data. Any thoughts or insights would be greatly appreciated. Thanks.

 Capture1.PNG

Capture.PNG 

Labels (2)
3 Replies
rubenmarin

Hi, top10 can be:
Sum({<DimensionField={"=Rank(Sum(invoiceTotal))<=10"}>} invoiceTotal)

and bottom10:
Sum({<DimensionField={"=Rank(-Sum(invoiceTotal))<=10"}>} invoiceTotal)
// just aded the '-' inSum(invoiceTotal)

To work with buttons you can create a Top10 buton with the value '+' and a bottom 10 button with value '-', and use the variable value in expression like this:
Sum({<DimensionField={"=Rank($(variableName)Sum(invoiceTotal))<=10"}>} invoiceTotal)
// $(variableName) will be converted to '+' for top 10 and to '-' for bottom 10
dreweezy
Partner - Creator II
Partner - Creator II
Author

Thank you. My issue is when using the extension for the variable set up I am only prompted with picking only one variable. It seems that I need to set up 2 variables for the top and bot 10. I have attached a png. Capture.PNG

dreweezy
Partner - Creator II
Partner - Creator II
Author

I completely understand your syntax. Thanks for that. The issue I am seeing is when I have my extension it only takes in one variable. Is there a way to dynamically let my variable 'vTopBot' know its top 10 and bot 10? Or am I forced to create 2 separate variables and buttons to accommodate this?