Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Add Set Analysis to existing variable expression

All of my expressions are stored as Variables.  I now need to apply some level of variability to some of the existing variables and I'm wondering if it's possible to add Set Analysis to an expression Variable in a chart.  In other words, the Variable remains as is but in a chart I'd like to add Set Analysis to the Variable for that chart only - as opposed to creating another Variable.  Thoughts?

4 Replies
Not applicable
Author

Are you talking about using the variable as part of a set analysis? Like this?:

=sum({$<MonthOffset={"$(=max(MonthOffset)-1)"}>}$(ReportExpression1))

Not applicable
Author

HI,

I don't think you can do this, but you can create separate variables for set analysis:

var1 = {$<Month={'jan'}>}

var2 = sum( $(var1) Sales)

Hope this helps!

Regards!

Not applicable
Author

You could try adding a parameter to your variable.  For example,

define a variable named vSALES and put this text into it:

sum( $1 MYSALES)

Now, you have a variable that must have an argument supplied.

To use it in a chart expression where you want to add the set analysis syntax code

something like this     =$(vSALES('{<Year={2010}>}'))

and the $1 will be replaced by   {<Year={2010}>}

For a chart expression where no extra set analysis is required code something like this

=$(vSALES(''))

Not applicable
Author

I'm trying to get this expression to work, and it ignores the 2006 set analysis expression.

Sum({$<"Year"={'2006'}>}$(vSetRolling12)Sales)