
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to create variable for greater than , less than in qliksense
Hi all,
I have field name totalamount in that I have some for values greater than 20k and less than 10k. I have a requirement like if a user want to click on a button it should show the less than values and if values greater than then he should click on another button.please suggest me which way it will be helpful by creating variable and applying them on button by using select values in field? Or is there another way to do that.
I have use syntax sum(totalamount<='10000', totalamount) but it's not working in variable.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make variable vVariable, assign value 1
Now in expression write
=if($(vVariable)=1,Sum({<totalamount={">=20000"}>} totalamount),
if($(vVariable)=0,Sum({<totalamount={"<=10000"}>} totalamount)))
Now in Sheet create a variable input, in variable part select vVariable and Show as Buttons, in values part Assign Value 1 and Label 2 as Greater than 20000 and add alternative Value 0 and label as Less Than 10000
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Select the table and on right side, check for Add-Ons --> Data Handling tab, there click on Un select Include zero values.
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make variable vVariable, assign value 1
Now in expression write
=if($(vVariable)=1,Sum({<totalamount={">=20000"}>} totalamount),
if($(vVariable)=0,Sum({<totalamount={"<=10000"}>} totalamount)))
Now in Sheet create a variable input, in variable part select vVariable and Show as Buttons, in values part Assign Value 1 and Label 2 as Greater than 20000 and add alternative Value 0 and label as Less Than 10000
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Xlitzdrama,
Where to write the expression? I'm trying but it's not accepting. Can you show any example?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you trying this in Table if yes, Click on Add Column then measure and then add this expression.
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks it worked ☺️

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good to hear, please click on Accept As Solution button so that it can help others too.
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi xlitzdrama,
Buttons are working but when I'm clicking on greater than 20k it is showing 0 as well, can you help me to Remove 0?
I'm attaching image as well for reference please check

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Select the table and on right side, check for Add-Ons --> Data Handling tab, there click on Un select Include zero values.
Please Accepts as Solution if it solves your query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot ☺️ you were really very helpful to me
