Forum Discussion
Calculate function not filtering when a variable is used.
- 2 years ago
Echoing Greg_Deckler on this one, but with a little more information. Variables are calculated only once and then stored only once and cannot be re-used in their current context. The only exception to this is if you create a variable that is a table:
ie. VAR _SourceTable = FILTER(ALL('Date'[Year]),'Date'[Year]>=2010)
and then later on you want to further filter this source table ie. VAR _MoreFiltering = FILTER(_SourceTable, [Year] >= 2013).Measures are calculated in the current filter context (sometimes that's okay if you want to keep the value static) but you can't use CALCULATE() to adjust that after the fact.
Echoing Greg_Deckler on this one, but with a little more information. Variables are calculated only once and then stored only once and cannot be re-used in their current context. The only exception to this is if you create a variable that is a table:
ie. VAR _SourceTable = FILTER(ALL('Date'[Year]),'Date'[Year]>=2010)
and then later on you want to further filter this source table ie. VAR _MoreFiltering = FILTER(_SourceTable, [Year] >= 2013).
Measures are calculated in the current filter context (sometimes that's okay if you want to keep the value static) but you can't use CALCULATE() to adjust that after the fact.