Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Chandu
Contributor II
Contributor II

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.

Labels (2)
2 Solutions

Accepted Solutions
neerajthakur
Creator III
Creator III

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

Thanks & Regards,
Please Accepts as Solution if it solves your query.

View solution in original post

neerajthakur
Creator III
Creator III

Select the table and on right side, check for Add-Ons --> Data Handling tab, there click on Un select Include zero values.

Thanks & Regards,
Please Accepts as Solution if it solves your query.

View solution in original post

8 Replies
neerajthakur
Creator III
Creator III

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

Thanks & Regards,
Please Accepts as Solution if it solves your query.
Chandu
Contributor II
Contributor II
Author

Hi Xlitzdrama,

Where to write the expression? I'm trying but it's not accepting. Can you show any example?

neerajthakur
Creator III
Creator III

Are you trying this in Table if yes, Click on Add Column then measure and then add this expression.

Thanks & Regards,
Please Accepts as Solution if it solves your query.
Chandu
Contributor II
Contributor II
Author

Thanks it worked ☺️

neerajthakur
Creator III
Creator III

Good to hear, please click on Accept As Solution button so that it can help others too.

Thanks & Regards,
Please Accepts as Solution if it solves your query.
Chandu
Contributor II
Contributor II
Author

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

16768792603306725321670719101881.jpg

neerajthakur
Creator III
Creator III

Select the table and on right side, check for Add-Ons --> Data Handling tab, there click on Un select Include zero values.

Thanks & Regards,
Please Accepts as Solution if it solves your query.
Chandu
Contributor II
Contributor II
Author

Thanks a lot ☺️ you were really very helpful to me