Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple definitions for one Variable.

I created some line charts with similar looking but different expressions and different formula. I used several variables to make my charts dynamic. I would like to see whether I can have different definitions for one variable in order to reduce the number of variables and to make the maintenance easier.

Thanks

Longmatch

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use variables within variables. For example:

vSales2012: sum({<Year={2012}>}Sales)

vSales2013: sum({<Year={2013}>}Sales)

vVariance:   num($(vSales2013)/$(vSales2012) -1,'#.0%')

This way you could redefine vSales2012 or vSales2012 and every variable that uses these variables (like vVariance) will use the new definitions.

You can also pass parameters to variables:

vSales: sum({<Year={$1}>}Sales)

vVariance: $(vSales(2013))/$(vSales(2012)) -1


talk is cheap, supply exceeds demand
Not applicable
Author

I am sorry I might not state my questions clearly. Here is my example. I have a variable named vVariance and its formula are different based upon the data type (continuous data vs discrete data). I do not want to use different variable names for different type of variances. How to implement it? Thanks