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: 
Krish
Contributor III
Contributor III

adding conditions to Variables in Set Command

Hi,

I am trying to re-use a formula which is used in multiple places in dashboard. I am trying to create a variable which is common across all the places like

sum({<payment={'cash'}>}sales) and create it as a variable vsales = sum({<payment={'cash'}>}sales),

Now I want to add a condition like country='IND' for one chart and country='usa' for other chart, but the calculation is same. 

sum({<payment={'cash'},country={'IND'}>}sales) & sum({<payment={'cash'},country={'AUS'}>}sales)

How can I create a variable with common features and re-use them by adding the additional condition based on requirement.

Labels (2)
1 Reply
QFabian
MVP
MVP

Hi @Krish , one option could be use alternate states inside the expressions.

So you can have the same field Country, more than one, but each one referencing to a different State

QFabian_1-1611159676218.png

Please check the qvw

 

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.