Forum Discussion
Calculation Group + ISSELECTEDMEASURE and Derived Measures
- 6 months ago
Hi jaryszek ,
Thank you for reaching out to the Microsoft Community Forum.
ISSELECTEDMEASURE() only refer the top‑level measure on the visual. It cannot detect measures referenced inside other measures. Calculation groups work only at the outermost evaluation layer. Use wrapper measures + disconnected slicer and use shared DimDate in visuals instead of calculation groups to get the desired result. wrapper measure is a measure that calls another measure or calculation instead of repeating the logic.
Please refer below steps.
1. Created DimDate table.
DimDate =CALENDAR(DATE(2025,1,1), DATE(2025,12,31))
2. Created Base Measures.
Daily
Actual Cost Daily = SUM(FactDaily[Cost])
Budget Amount Daily = SUM(FactDaily[Budget])Monthly
Actual Cost Monthly = SUM(FactMonthly[Cost])
Budget Amount Monthly = SUM(FactMonthly[Budget])
3. By using Wrapper Measures and Disconnected Selector Table , We route only the semantic base measures, Instead of routing every derived measure.Disconnected table:
PeriodMode =
DATATABLE(
"Mode", STRING,
{
{ "Daily" },
{ "Monthly" }
}
)
Wrapper Measures:Actual Cost =
SWITCH(
SELECTEDVALUE('PeriodMode'[Mode]),
"Daily", [Actual Cost Daily],
"Monthly", [Actual Cost Monthly]
)Budget Amount =
SWITCH(
SELECTEDVALUE('PeriodMode'[Mode]),
"Daily", [Budget Amount Daily],
"Monthly", [Budget Amount Monthly]
)Evaluations Budget Variance =
[Actual Cost] - [Budget Amount]
4. Please refer below model snap.5. Please refer below output snaps and attached pbix file.
Fact Daily:
100 + 120 + 130 = 350
90 + 110 + 125 = 325
Variance = 25
FactMonthly:
3500 + 4200 = 7700
3400 + 4000 = 7400
Variance = 300
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
jaryszek You are right , ISSELECTEDMEASURE() only fires for the measure that the visual asks for, not for measures referenced inside another measure. Once you wrap things in the calc group only ever sees Evaluations Budget Variance — the inner measures are already resolved before the calc group logic runs.
That’s not a bug; it’s how the DAX evaluation pipeline works.
- jaryszek6 months agoSuper User
thanks. What is your recommendation for handling derived measures in calc groups?
Best,
Jacek