Forum Discussion

jaryszek's avatar
jaryszek
Super User
6 months ago
Solved

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] Ho...
  • v-dineshya's avatar
    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