Forum Discussion
Anonymous
3 years agoNot applicable
Summarizing within a VAR expression
Hi all, I'm struggling to find the answer, so hopefully someone here can help me. I feel like it's an easy fix within DAX for a trained eye. π This is an example set I had. Store Matrix...
- 3 years ago
Anonymous
Measure = VAR numerator = CALCULATE ( SUMX ( ALL ( 'table'[Store] ), CALCULATE ( SUM ( 'table'[Average Revenue] ), ALLEXCEPT ( 'table', 'table'[Store], 'table'[Matrixcode] ) ) ) ) VAR denominator = CALCULATE ( DISTINCTCOUNT ( 'table'[Store] ), ALLEXCEPT ( 'table', 'table'[Matrixcode] ) ) RETURN DIVIDE ( numerator, denominator )
smpa01
Community Champion
3 years agoAnonymous
Measure =
VAR numerator =
CALCULATE (
SUMX (
ALL ( 'table'[Store] ),
CALCULATE (
SUM ( 'table'[Average Revenue] ),
ALLEXCEPT ( 'table', 'table'[Store], 'table'[Matrixcode] )
)
)
)
VAR denominator =
CALCULATE (
DISTINCTCOUNT ( 'table'[Store] ),
ALLEXCEPT ( 'table', 'table'[Matrixcode] )
)
RETURN
DIVIDE ( numerator, denominator )Anonymous
3 years agoNot applicable
Perfect, this worked! Thanks for the reply. I will study the formula to fully understand what you've written π