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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
KarmenN
Regular Visitor

Help with cumulative sum

Hello!

 

I have a table, where I have material demand/supply qtys. There might be multiple rows for one day, because I have demand and supply numbers + demand might come from different orders.

I have created DAX formula to calculate cumulative stock, but now I have 2 issues:

 

1)When I create pivot table, then QTY sum is correct, but Cumulative value is double (because these rows are with the same date and both rows have the same cumulative sum value),

For example QTY for 19.09 is -8750 and cumulative sum is -29874, but I would like it to be -14937 (Picture 2.).

2)When I group my values based on month, then I get total sum of cumulative day sums, but I would like to see cumulative sum by the end of the month (Picture 3.)

 

Can anyone please help me with these issues? What i should change in my formula or table? Is it even possible to create it in the way I would like to do it?

 

Best wishes,

Karmen

 

 

1.1.2.2.3.3.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@KarmenN , Try to create a measure with help from date table

 

Cumm = CALCULATE(SUM(Table[Qty]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

Also create a separate type dimension, join it with your table and use that is the slicer and visual

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

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @KarmenN ,

 

According to your description, I created a sample, and here is my solution.

Keep your DAX formula.

 

Cum =
VAR CurrentDate = 'qty'[start_date]
VAR FilteredTable =
    FILTER ( 'qty', 'qty'[start_date] <= CurrentDate )
RETURN
    CALCULATE ( SUM ( 'qty'[QTY] ), FilteredTable )

 

Select a Matrix, put “start_date” into rows, “QTY” and “Cum” into Valus and choose “start_date” “SUM of QTY” “Median of Cum”. Then, you will get the expected result.

vxiaosunmsft_0-1664170114459.pngvxiaosunmsft_1-1664170114463.png

Select a Matrix, put “start_date” into rows, “QTY” and “Cum” into Valus and choose “SUM of QTY” “SUM of Cum”. Then, you will get the expected result.(Picture 3)

vxiaosunmsft_2-1664170114464.pngvxiaosunmsft_3-1664170114466.pngvxiaosunmsft_4-1664170114467.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@KarmenN , Try to create a measure with help from date table

 

Cumm = CALCULATE(SUM(Table[Qty]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

Also create a separate type dimension, join it with your table and use that is the slicer and visual

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

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.