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
learner03
Post Partisan
Post Partisan

Cumulative difference

 

How can I get cumulative difference as below?

QtyCumulative difference
105-
111-6
2388
45-22
100-55
7624
4531
63-18
1 ACCEPTED SOLUTION

So, you need to just reverse the order Cumulative Difference =([Prev])-CALCULATE(sum('Cumulative Diff'[Qty])) here, right?

 

>> Keep Calculate first 

 

Regards,

Ritesh

 

 

View solution in original post

3 REPLIES 3
ribisht17
Super User
Super User

Hi ,akakapoor,

 

NOTE: Add a custom index column first Creating an Index column using a Power Query - Power BI Docs

 

Step 1 

Prev = CALCULATE(sum('Cumulative Diff'[Qty]),

FILTER(all('Cumulative Diff'),('Cumulative Diff'[Index.1]+1) =

max('Cumulative Diff'[Index.1])))
 
Step 2
 
Cumulative Difference =([Prev])-CALCULATE(sum('Cumulative Diff'[Qty]))
 
Last Step = /get the - at the top
Final Output = IF(min('Cumulative Diff'[Index.1])=1,"-",'Cumulative Diff'[Cumu Diff]
 
ribisht17_0-1649248749811.png

 


 

 
Regards,
Ritesh
Please mark the answer as a solution if it helps you so that it can help others as well

@ribisht17 I tried with the above and I am getting below view as per my data-

akapoor03_0-1649640654820.png

 

The dates are rolling14 days. This is giving me opposite output, example-Bins Count OUT were more than the previous day, so basically 22 more were completed than previous day, but this is showing -22.

How can I make it Positive?

So, you need to just reverse the order Cumulative Difference =([Prev])-CALCULATE(sum('Cumulative Diff'[Qty])) here, right?

 

>> Keep Calculate first 

 

Regards,

Ritesh

 

 

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.