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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Cumulative Sum Measure

Hi all,

 

I'm struggling with creating a cumulative sum in Power BI desktop.  The cumulative sum would be used to figure out a buying schedule for one of our internal buyers here.  So the fields within the table are:

Date / Purchase Order / Item Number / Quantity

 

So with each change in Purchase Order/Item Number, I need to calculate the cumulative sum of the Quantity field.

 

How can I do this?  I've tried the measure below, but this isn't working - nothing I've found online is working for this.  PRODPURCH is the name of the table I'm using.  Thanks in advance!

MEASURE =
CALCULATE (SUM ( PRODPURCH[QUANTITY] ),
FILTER (ALL ( PRODPURCH ),
PRODPURCH[Date] <= SELECTEDVALUE ( PRODPURCH[Date] )))
3 REPLIES 3
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below formula:

Measure = CALCULATE(SUM(PRODPURCH[Quantity]),FILTER(ALL(PRODPURCH),'PRODPURCH'[Item number]<=MAX('PRODPURCH'[Item number])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Daniel,

 

Thank you for the response, but unfortunately this did not work, please see the attached image.  

 

At each change in quantity, I'd expect the 'Measure' measure to change along with it, but it does not.  Can you please advise?

Capture.JPG

 

Thanks, Gary


At each change in quantity, I'd expect the 'Measure' measure to change along with it


What could you mean it? Could you please offer me your sample data to have a test?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.