Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Emil_bros
Contributor III
Contributor III

variable in set analysis for dynamic change

Hi,

I need to find a formula where variable 'VERSION' changes dynamically in relation to given month.

In my case names of VERSIONS are corresponding to MONTH names (formated as data)

 
 

 

 

 

 

 

 

My formula is not working:

sum({<VERSION = {'=Month'}>} VAL)

As a result I want the formula to take value for EACH MONTH from different VERSION

1 Solution

Accepted Solutions
sunny_talwar

So, you want to add the set analysis in this new expression? Try this

Sum({<COST1 = {'Net Sales'}>} If(VERSION = Month, VAL))

View solution in original post

10 Replies
sunny_talwar

Not entirely sure, but may be this

Sum({<VERSION = p(Month)}>} VAL)
Emil_bros
Contributor III
Contributor III
Author

not working, error in expression

sunny_talwar

Sorry this

Sum({<VERSION = p(Month)>} VAL)
Emil_bros
Contributor III
Contributor III
Author

thank you Sunny however now the result is a sum of all versions (please see the attached)

Emil_bros
Contributor III
Contributor III
Author

should be what is marked blue in attached file

 

 

sunny_talwar

Set analysis won't work for this... try this

Sum(If(VERSION = Month, VAL))
Emil_bros
Contributor III
Contributor III
Author

thank you it now works however I wasn't exactly clear about the data model.

I already use set analysis in the expression to calculate value:

sum({<COST1 = {'Net Sales'}>} VAL)

so to use your formula properly I need to have COST1 filter selected on "Net Sales" which is impacting my other expressions.

Is there any other way?

 

sunny_talwar

So, you want to add the set analysis in this new expression? Try this

Sum({<COST1 = {'Net Sales'}>} If(VERSION = Month, VAL))
Emil_bros
Contributor III
Contributor III
Author

Perfect! Exactly what I need. Thank you very much