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
jersey417
Helper I
Helper I

Running Sum - Conditional based on multiple fields

All, 

 

I need to create a running sum that is conditional based on multiple other fields. The running sum will need to run 

 

This is the current calculated column that I have created

Running Sum = (CALCULATE( SUM('Data V2'[Planned Receipt]), FILTER( ALLEXCEPT( 'Data V2', 'Data V2'[Plant], 'Data V2'[Material] ), 'Data V2'[deliver date] <= MAX ('Data V2'[deliver date]))))
 
However, the following is only populating the sum of the planned receipts not the running sum. 
 
Here are the fields that are conditiaonal where the run sum would need to stop/start again;
Mateiral
Plant 
 
The calcualtion should be based on the following order. I can sort the data in the source sql statement if requred. 
1) Deliver Date - Oldest to newest
2) Delivery(Number) Lowest to highest
3)Line (number) Lowest to highest 
 
Material Plant Deliverydeliver DateLine Planned Receipt Running Sum
10000570020373500012/15/201910500500
10000570020373502212/18/2019107001200
10000570020373667012/19/2019102001400
10000570020373667012/19/2019203001700
10000570020373667012/19/2019305002200
1000057002037652891/1/20201050007200
1000057002037999991/1/202010600013200
10000800020373500112/15/20191060006000
10000800020373500412/16/2019106006600
20000570012357456812/15/2019108000080000
10000570012548793612/19/201910580005

 

I'm not sure where I went wrong nor can I find a post with relatable content. 

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @jersey417 ,

 

check this out.

 

PBIX

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@jersey417 for time based calculations, it is recommended to add Date Table in your model and there are tons of post on how to add one and set relationship with this date table with your transaction table

 

And change your measure like this

 

Running Sum = (CALCULATE( SUM('Data V2'[Planned Receipt]), FILTER( All( DateTable (, 'Date Table'[date] <= MAX ('Data Table'[date]))))

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @jersey417 ,

 

check this out.

 

PBIX

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


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.