Forum Discussion
Calculation Group + ISSELECTEDMEASURE and Derived Measures
Hi all,
I’m using a calculation group to route measures between Daily / Monthly versions using ISSELECTEDMEASURE(). This works fine for base measures like:
[Actual Cost]
[Budget Amount]
However, I’ve noticed that derived measures like:
Evaluations Budget Variance = [Actual Cost] - [Budget Amount]do not trigger the calc group logic for [Actual Cost] or [Budget Amount] when placed on a chart — the calc group only sees [Evaluations Budget Variance] as the selected measure.
From what I understand, ISSELECTEDMEASURE() only works on the top-level measure in the visual and cannot detect measures used inside other measures.
Is there any alternative pattern or recommended approach to handle this cleanly, other than:
explicitly adding each derived measure to the calc group, or
moving Daily/Monthly logic into the derived measure itself?
Thanks,
Jacek
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
5 Replies
- elitesmitpatelSolution Supplier
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.
- jaryszekSuper User
thanks. What is your recommendation for handling derived measures in calc groups?
Best,
Jacek
- cengizhanarslanSuper User
Instead of expecting the calc group to rewrite [Actual Cost] and [Budget Amount] inside derived measures, make the calc item define “Daily vs Monthly” as a transformation of whatever measure is being evaluated:
-- Calc item: Monthly CALCULATE( SELECTEDMEASURE(), -- your monthly logic (e.g., change date grain, use month end, etc.) )- jaryszekSuper User
Thanks — just to clarify: that this pattern works when a measure always reads from the same fact table and Daily vs Monthly is only a matter of date filtering.
In my case, Daily and Monthly come from separate fact tables, so selected Measure can’t switch the underlying table and explicit routing is still required.
- v-dineshyaCommunity Support
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