Forum Discussion
beanboy
1 year agoFrequent Visitor
When to use variables vs measures
Hi everyone, came across some DAX behavior I could use some clarification on. I have some pseudo-code below, but basically I am taking a unique Customers table and counting the rows that meet two con...
- 1 year ago
Measures are dynamic, they recalculate for each different filter context. You may not always want that, so you materialize intermediate results into variables (which is actually a misnomer as for all intents and purposes these are constants, not variables) so the values are no longer impacted by subsequent measure calculations.
You can materialize intermediate steps into scalar or table variables but the final result of the measure always must be a scalar value.
beanboy
1 year agoFrequent Visitor
Thank you. I understand conceptually what you mean, still trying to master it though.