Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ThomasCh
Frequent Visitor

Compare a measure that is affected by calculation group, and a measure that is not affected

Hello,

 

I am trying to compare two measures; one that is affected by a calculation group, and one that is not affected by the calculation group. The calculation item is written as follows: 

ThomasCh_0-1749026701674.png

 

Then I have two identical measures, where one of them has _calc in it's name.

Measure that is not to be affected:

ThomasCh_1-1749026769092.png

Measure to be affected:

ThomasCh_2-1749026791267.png

Now I try to calculate the difference between them.

 

Calculation item not filtered (works as expected as the numbers are the same):

ThomasCh_3-1749026891127.png

 

Calculation item filtered (and NOT working as expected, as the numbers now are different, but still get 0 in "Diff":

ThomasCh_4-1749026923578.png

 

How do I get Power BI to understand that the _calcRevenueActual has another value after the calculation item has been filtered? 

Thanks in advance!



 



1 ACCEPTED SOLUTION
v-ssriganesh
Community Support
Community Support

Hi @ThomasCh,
Thank you for reaching out to the Microsoft fabric community forum.

I have reproduced your scenario in Power BI Desktop and successfully achieved the expected output as per your requirements. To summarize:

  • When the slicer is set to "None", both Revenue actual and Dynamic _calcRevenueActual show the same values, with Diff as 0.
  • When the slicer is set to "LY", Dynamic _calcRevenueActual correctly reflects last year’s values (e.g: 0 for 2023 since there’s no 2022 data, and 3500 for 2024), and Diff shows the expected differences (3500 for 2023, 1300 for 2024).

To achieve this, I:

  • Created a DimDate table with a continuous daily date range from January 1, 2022, to December 31, 2024, to resolve the "gaps in dates" error when marking it as a date table.
  • Used a Time Calculations table with "None" and "LY" options to simulate the calculation group via a slicer.
  • Adjusted the Dynamic _calcRevenueActual measure to correctly return 0 when no data exists for the previous year.

For your reference, I’m attaching the .pbix file containing the solution. You can download it and review the setup to apply it to your report.


If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

View solution in original post

8 REPLIES 8
v-ssriganesh
Community Support
Community Support

Hi @ThomasCh,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @ThomasCh,

May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-ssriganesh
Community Support
Community Support

Hi @ThomasCh,
Thank you for reaching out to the Microsoft fabric community forum.

I have reproduced your scenario in Power BI Desktop and successfully achieved the expected output as per your requirements. To summarize:

  • When the slicer is set to "None", both Revenue actual and Dynamic _calcRevenueActual show the same values, with Diff as 0.
  • When the slicer is set to "LY", Dynamic _calcRevenueActual correctly reflects last year’s values (e.g: 0 for 2023 since there’s no 2022 data, and 3500 for 2024), and Diff shows the expected differences (3500 for 2023, 1300 for 2024).

To achieve this, I:

  • Created a DimDate table with a continuous daily date range from January 1, 2022, to December 31, 2024, to resolve the "gaps in dates" error when marking it as a date table.
  • Used a Time Calculations table with "None" and "LY" options to simulate the calculation group via a slicer.
  • Adjusted the Dynamic _calcRevenueActual measure to correctly return 0 when no data exists for the previous year.

For your reference, I’m attaching the .pbix file containing the solution. You can download it and review the setup to apply it to your report.


If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

Hi @ThomasCh,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.
Thank you.

johnt75
Super User
Super User

Once the calculation group has been applied to the Diff measure it will not be applied again for any measures which Diff calls. You need to not apply the calculation group to the diff measure and manually apply it inside the measure, e.g.

Diff =
[Revenue Actual]
    - CALCULATE (
        [Revenue Actual],
        TREATAS ( { "LY" }, 'Time Calculations'[Time Calculations] )
    )
burakkaragoz
Community Champion
Community Champion

Hi @ThomasCh ,

 

You’re super close! The problem is that your calculation group still affects your [Diff] measure, because when you do something like [Revenue actual] - [_calc.RevenueActual]the calculation group logic gets applied to each part separately—even if you only want it on one.

Solution:
To stop the calculation group from affecting your [Diff] measure, you need to add check in your calculation group’s DAX so that it only runs for the measures you want.

For example, update your calculation item like this:

dax
 
IF(
    CONTAINSSTRING(SELECTEDMEASURENAME(), "_calc") 
    && SELECTEDMEASURENAME() <> "Diff", // Exclude the Diff measure
    CALCULATE(
        SELECTEDMEASURE(),
        PARALLELPERIOD('DimDate'[Date], -12, MONTH)
    ),
    SELECTEDMEASURE()
)

Or, if your [Diff] measure is calculated measure, you could check for pattern or use another logic to exclude it.

TL;DR:
Add an extra check so your calculation group doesn’t fire on [Diff]. That way, only the measures you want get affected by the time calculation.

Let me know if you need more specific example!
translation and formatting supported by AI

Hi and thanks for the reply!

Unfortunately it doesn't seem to work. 


Updated calculation item:

ThomasCh_0-1749027680818.png

Diff measure:

ThomasCh_1-1749027696142.png

I still get 0 in diff:

ThomasCh_2-1749027715001.png

 

Hi @ThomasCh ,

 

Your calculation group logic is still being applied when you use [Diff], because [Diff] references [_calc.RevenueActual], so the calculation group ends up firing on that measure anyway.

Try this approach:
Instead of referencing [_calc.RevenueActual] directly in [Diff], use SELECTEDMEASURE() logic inside the calculation group to return BLANK() if the selected measure is [Diff].
But, since [Diff] is calling the _calc measure, the calculation group will still process it. To avoid this, you might need to “shield” [Diff] from the calculation group by restructuring things bit.

Here’s what you can do:

  1. Create base measure (not affected by calculation group):

    dax
     
    Revenue actual (Base) =
    CALCULATE(
        SUM(FactFinanceActual[Amount]),
        LEFT(DimAccount[AccountGroup],1) = "3"
    )
  2. Have your _calc measure reference the base:

    dax
     
    _calc.RevenueActual =
    [Revenue actual (Base)]
  3. Your Diff measure:

    dax
     
    Diff =
    [Revenue actual (Base)] - [_calc.RevenueActual]
  4. Update your calculation group logic to only affect measures ending with "_calc" and NOT [Diff] or [Revenue actual (Base)]:

    dax
     
    IF(
        CONTAINSSTRING(SELECTEDMEASURENAME(), "_calc")
        && SELECTEDMEASURENAME() <> "Diff",
        CALCULATE(
            SELECTEDMEASURE(),
            PARALLELPERIOD('DimDate'[Date], -12, MONTH)
        ),
        SELECTEDMEASURE()
    )

Key Point:
Make sure [Diff] and [Revenue actual (Base)] are never picked up by the calculation group’s logic. Only [_calc.RevenueActual] should be affected. By structuring it this way, [Diff] will always be the difference of the "raw" values.

Let me know if this does the trick or if you see any weird results. If you still have trouble, share your calculation group’s exact logic and we can troubleshoot further!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.