Forum Discussion
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?
4 Replies
- Greg_Deckler
Community Champion
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- AnonymousNot 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])ReturnIF(HASONEVALUE(TimeTransactions[Project]); [GuideLine];SUMX(__table; [__value]))But it gives me even weirder valuesCan you help me?Best regards,Queenie- Greg_Deckler
Community Champion
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.
- v-kelly-msft
Community Support
Hi Anonymous
So what's in table 'TimeTransactions'?Can you show me your .pbix file?
Best Regards,
KellyDid I answer your question? Mark my post as a solution!