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
Anonymous
Not applicable

Cumulative Total of Multiple Measures

I am attempting to add two measures together to have a cumulative total. However, it is returning a gap in the line (red line on graph below) when I want the line to just continue on. As you can see in the graph the value for the combined cumulative total also restarts again after the month with no data.

 

What I am aiming for is that the line stays flat on 25 (value in example) for the month with 0 changes and then continue to increase (as the cumulative total should) for months where there is data. 

 

Below is the code I have used to calculate the cumulative totals independent of one another:

 

# Actual Fitted Cumulative =
Var _Result =
CALCULATE(sum('Stock Movement Detail'[Qty]),FILTER(ALLSELECTED('Stock Movement Detail'), 'Stock Movement Detail'[Date Out]<=MAX('Stock Movement Detail'[Date Out])),'Stock Movement Detail'[Status To]="Fitted")

Return _Result

 
 

Forecast Cumulative =
Var _Result =
CALCULATE(sum('Forecast Fitment'[Forecast Use]),FILTER(ALLSELECTED('Forecast Fitment'), 'Forecast Fitment'[ChangeDate (Year > Month > Day)]<=MAX('Forecast Fitment'[ChangeDate (Year > Month > Day)])))

Return _Result

 

 

 

Below is the forumla I attempted to use to return the cumulative total of the measures combined. 

Cumulative of Fitments and Future Forecast =
[# Actual Fitted Cumulative] + [Forecast Cumulative]

 

 

 

 

Chris2690_3-1636074697409.png

 

Any help with this would be much appreciated.

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You should use a common date's column on axis and formula

 

Try like

 


# Actual Fitted Cumulative =
Var _Result =
CALCULATE(sum('Stock Movement Detail'[Qty]),FILTER(ALLSELECTED('Date'), 'Date'[Date]<=MAX('Date'[Date])),Filter('Stock Movement Detail', 'Stock Movement Detail'[Status To]="Fitted")

Return _Result

Forecast Cumulative =
Var _Result =
CALCULATE(sum('Forecast Fitment'[Forecast Use]),,FILTER(ALLSELECTED('Date'), 'Date'[Date]<=MAX('Date'[Date])))

Return _Result

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@amitchandak thank you for your help. This has worked.

 

amitchandak
Super User
Super User

@Anonymous , You should use a common date's column on axis and formula

 

Try like

 


# Actual Fitted Cumulative =
Var _Result =
CALCULATE(sum('Stock Movement Detail'[Qty]),FILTER(ALLSELECTED('Date'), 'Date'[Date]<=MAX('Date'[Date])),Filter('Stock Movement Detail', 'Stock Movement Detail'[Status To]="Fitted")

Return _Result

Forecast Cumulative =
Var _Result =
CALCULATE(sum('Forecast Fitment'[Forecast Use]),,FILTER(ALLSELECTED('Date'), 'Date'[Date]<=MAX('Date'[Date])))

Return _Result

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak , I have been working on this and I have noticed when I adjusted my formula's one of the other measures is not working properly. I have tried several different ways to recalcualte it and I am hoping you can help. 

 

I have the line on the graph (Actaul in dark blue) and I want the graph line to end when my last date for that for Stock Movement Detail ends (in this example it is June 2021).  As you can see previously I have used that in my calculated measure (as outlined in my initial question) but that gave me gaps when there was no information for the month.  Using points from your initial feedback I have adjusted my formula (as per below) but can not get the dark blue line to end when my data for Stock Movement Detail ends while maintaining a continuous line. 

 

# Actual Fitted Cumulative =
Var _Result =
CALCULATE(sum('Stock Movement Detail'[Qty]),FILTER(ALLSELECTED('Date'), 'Date'[Date]<=MAX('Date'[Date])),'Stock Movement Detail'[Status To]="Fitted")

Return _Result

 

Chris2690_0-1636419005403.png

 

 

 

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.