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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
kjel
Frequent Visitor

Sum of subtotals is greater than the grand total

Hi, I have a measure which gives me the correct value for the grand total but when I try splitting it down into subtotals, the sum of the subtotals becomes greater than the grand total. I'm fairly sure that I'm messing something up w.r.t. the filter context but I'm fairly new to DAX and I can't find the error.

 

I have these two measures set up to calculate the LTM sum of my sales, meaning that for every month I want to calculate the total sales in that month and the previous 11 months. Pretty simple for historical months but in the current month I want to add my forecasted numbers to my actuals and in future months I want to show the forecasted numbers. These are the measures:

 

Remaining Sales Budget =
    CALCULATE(
        MAX( [Sales Budget Amount] - [Sales Amount],0 ),
        KEEPFILTERS( 'Date'[DateTime] >= DATE(YEAR(TODAY()),MONTH(TODAY()),1) )
    )
 
Sales&Budget LTM =
    CALCULATE(
        [Sales Amount] + [Remaining Sales Budget],
        DATESINPERIOD( 'Date'[DateTime],MAX('Date'[DateTime]),-12,MONTH )
    )
 

I hope my explanation makes sense. Anyway, I've checked and I get the correct LTM totals when using these measures UNTIL I try to create a visual that splits the total sales amount, for example by customer segment or product type.

Screenshot 2022-11-23 095342.png

 

The total at the bottom is the correct number, however the sum of the subtotals is 343,645,368 (not USD fyi)

 

 

 

 

 

Any ideas on how to fix this? Let me know if I need to provide more information 🙂

1 ACCEPTED SOLUTION
kjel
Frequent Visitor

Just wanted to add that I've resolved the issue, it was pretty simple: when looking at the totals I either under/overshoot my forecast and the LTM reflects that, however when I split the actuals and forecasted numbers I can underperform in some categories while overperforming in others and the MAX() function then makes the sum of the subtotals larger than the "grand total".

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Greate job!

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
kjel
Frequent Visitor

Just wanted to add that I've resolved the issue, it was pretty simple: when looking at the totals I either under/overshoot my forecast and the LTM reflects that, however when I split the actuals and forecasted numbers I can underperform in some categories while overperforming in others and the MAX() function then makes the sum of the subtotals larger than the "grand total".

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.