cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
plerner16
New Member

Column Subtotal Issue

I have a measure that pulls Actuals data from Jan-Current Month and Forecasted data for the rest of the year with a formula: 

CALCULATE(IF(
    Max(Master_Date[Daily]) <= Today(),
    Sheet1[Actuals],
    Sheet1[FCST]))

The issue is that when I filter on the full year, it only shows Forecast totals, but if I filter down to August (The last month of Actuals) then it'll show me the correct Subtotal for Jan-Aug. I need to figure out how to make it show me Jan-Dec subtotals where it sums Jan-Aug Actuals and then Sep-Dec Actuals.
1 ACCEPTED SOLUTION
AmiraBedh
Solution Sage
Solution Sage

The problem here is that when you filter to the full year, the context of your measure doesn't know how to differentiate between months that should use `Actuals` and those that should use `Forecasted` data.

You need to iterate through each day in your current context and determine whether to take `Actuals` or `Forecasted` data for that day.

One approach is to use the `SUMX` function.

Total Actuals and Forecast =
SUMX (
VALUES ( Master_Date[Daily] ),
IF (
Master_Date[Daily] <= TODAY(),
CALCULATE ( SUM ( Sheet1[Actuals] ) ),
CALCULATE ( SUM ( Sheet1[FCST] ) )
)
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@plerner16 I agree with @AmiraBedh, adding some content here that may help you understand what is going on. First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
AmiraBedh
Solution Sage
Solution Sage

The problem here is that when you filter to the full year, the context of your measure doesn't know how to differentiate between months that should use `Actuals` and those that should use `Forecasted` data.

You need to iterate through each day in your current context and determine whether to take `Actuals` or `Forecasted` data for that day.

One approach is to use the `SUMX` function.

Total Actuals and Forecast =
SUMX (
VALUES ( Master_Date[Daily] ),
IF (
Master_Date[Daily] <= TODAY(),
CALCULATE ( SUM ( Sheet1[Actuals] ) ),
CALCULATE ( SUM ( Sheet1[FCST] ) )
)
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors