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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Wrong Totals

Hi guys,

 

I am trying to create my own forecast because it is based on a planning.

To do this I have a few measures and some data to go with it.

 

Measure to determine the price of the hours in a certain month:
Planning = sumx('Forecast'; 'Forecast'[Hours] * 'Forecast'[PriceFC])

Measure to calculate the cumulative total of the worked hours
CumulativeTotal = CALCULATE(Sum(TimeTransactions[AmountFC]);FILTER(ALL(PowerBI_Calendar[Date]); PowerBI_Calendar[Date] <= Max(PowerBI_Calendar[Date])))

Measure to determine if I need to use the actual worked hours or the planning:
GuideLine = IF(OR(SUMX(TimeTransactions; TimeTransactions[AmountFC]) = BLANK(); SUMX(TimeTransactions; TimeTransactions[AmountFC]) < [Planning]); [Planning]; SUM(TimeTransactions[AmountFC]))

Measure to get the cumulative total of my guideline so it can be shown nicely in a graph:
Cumulative Forecast = CALCULATE([GuideLine];FILTER(ALL(PowerBI_Calendar[Datum]); PowerBI_Calendar[Datum] <= Max(PowerBI_Calendar[Datum])))

The problem lies with the Cumulative forcast, it should be a different number than it is showing.
Does anyone know what I am doing wrong?

 

Sample data 

 

Capture1(1).PNGCapture2.PNGCapture1.PNG

 

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @Anonymous 

 

So what's in table 'TimeTransactions'?Can you show me your .pbix file?

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

Greg_Deckler
Super User
Super User

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

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

 

I have been trying your solution, but I am not sure how to continue.

I made this measure:

 

MyMeasure2 =
VAR __table = SUMMARIZE(TimeTransactions;[Project];"__value"; [GuideLine])
Return
IF(HASONEVALUE(TimeTransactions[Project]); [GuideLine];SUMX(__table; [__value]))
 
But it gives me even weirder values
 
Capture3.PNG
 
Can you help me?
 
Best regards,
Queenie

 

Try this:

 

MyMeasure2 =
VAR __table = SUMMARIZE(TimeTransactions;[Maand];"__value"; [GuideLine])
Return
IF(HASONEVALUE(TimeTransactions[Project]); [GuideLine];SUMX(__table; [__value]))

 

You should summarize by whatever you are summarizing by in your table visualization (it looks like "Maand"). The value (__value) should be the measure you want to aggregate correctly in the total line. 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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