-
Re: Referencing Measures in other Measures
Mark Ritter Oct 27, 2017 12:59 PM (in response to William Fu)There is plenty of documentation on Set Analysis and probably a bunch of YouTube videos explaining the syntax.
Typically you can't reference a master measure(a saved measure) inside of another measure. You can reference variables inside of a measure. But whether this works or not really depends on the specifics of what you are trying to do.
-
Re: Referencing Measures in other Measures
Chris Casby Oct 27, 2017 4:00 PM (in response to William Fu) -
Re: Referencing Measures in other Measures
Janani Reddy Oct 28, 2017 9:47 AM (in response to William Fu)Hi William,
May be you can use the column function in Qlik sense
Pasting a discussion link here Column() function
-
Re: Referencing Measures in other Measures
Oleg Troyansky Oct 28, 2017 1:14 PM (in response to William Fu)Hi WIlliam,
to summarize what others mentioned here:
- Unfortunately, Master Items cannot be referenced directly in other Master Items. This would be a nice feature, but it's not currently there.
- What most professionals do to overcome this problem, is store various formulas in variables and then use the variable in the definition of the Master Items. Multiple variables can be combined in expressions. For example:
Variables:
exp_Sales = 'sum(Sales)'
exp_Cost = 'sum(Cost)'
Master Item Definitions:
Total Sales = $(exp_Sales)
Total Cost = $(exp_Cost)
Margin % = ($(exp_Sales) - $(exp_Cost)) /$(exp_Cost)
- While you may manage your variables manually, using the little variable overview "x=", it's more robust if you store your formulas in an external text file and load them during the data load, generating the variables during the load. This way, you can share these definitions across multiple apps, and maintain them in one central place.
- The syntax that involves {$< ... >} is called Set Analysis. Unfortunately, the expression editor doesn't offer much help for troubleshooting the syntax, other than telling you that something must be wrong (and sometimes even that is a false alarm...). You kinda have to know the syntax and find any errors manually. There are many sources, free or commercial, that describe Set Analysis. I'm teaching a half-day lecture about it at the Masters Summit for Qlik.
I'm describing all of these techniques, including Set Analysis and many other advanced Qlik development techniques in my book QlikView Your Business: The Expert Guide to QlikView and Qlik Sense. Check it out!
cheers,
Oleg Troyansky
-
Re: Referencing Measures in other Measures
William Fu Oct 30, 2017 8:15 AM (in response to Oleg Troyansky )Thank you for the thorough response and the txt file tip Oleg!
Is it possible to add filters for these variables, or is each one its own "entity"?
For example, I currently have these two variables:
TTD = Count({$<DtInclusao-={'1/1/1900'}>} NroProposta)
Booked = Count({$<IndDesemb={'S'},DtInclusao-={'1/1/1900'}>} NroProposta)
Instead of using $(Booked) as a master item, can I somehow add the IndDesemb={'S'} criteria to the $(TTD) variable?
-