Your measure had two issues:
- it was missing the context transition, this can be fixed adding
CALCULATE
where a context transition is needed
- The
[Total Direct Expense total for Region (c)]
uses ALLSELECTED
,
ad it's called inside an iterator. But we can move the measure
before the iteration using a variable instead. (The number 13,703 is wrong)
The measure then becomes
Final Result (a-c) =
VAR TotalExpense = [Total Direct Expense total for Region (c)]
RETURN
SUMX (
VALUES ( Sheet1[Region] ),
IF (
Sheet1[Region] = "Americas",
CALCULATE (
SUM ( Sheet1[Total Expense (a)] ) - TotalExpense
),
CALCULATE (
SUM ( Sheet1[Total Expense (a)] )
)
)
)
Now the final result is
A rather complex article about ALLSELECTED explaining what is the shadow filter and why calling ALLSELECTED after a context transition in an iteration doesn't work as expcected can be found here https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…