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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
MarceloSaez
Helper I
Helper I

Running sum based on value change

Hello.

I need to calculate the running cumulative of the column "Oil", but reset the calculation every time the column "Name" changes.

Note that the column "Date" is important also because the running sum is time-correlative.

My Data:

Date Name Oil
01/01/2000 M-1 210
01/02/2000 M-1 195
01/03/2000 M-1 266
01/04/2000 M-1 223
01/05/2000 M-1 190
01/06/2000 M-1 247
01/07/2000 M-1 233
01/08/2000 M-1 219
01/03/2002 M-2 197
01/04/2002 M-2 160
01/05/2002 M-2 180
01/06/2002 M-2 160
01/07/2002 M-2 156
01/03/2002 M-3 174
01/04/2002 M-3 177
01/05/2002 M-3 180
01/06/2002 M-3 169
01/07/2002 M-3 165

 

What I want to achieve:

Date Name Oil Oil_Cum
01/01/2000 M-1 210 210
01/02/2000 M-1 195 405
01/03/2000 M-1 266 671
01/04/2000 M-1 223 894
01/05/2000 M-1 190 1084
01/06/2000 M-1 247 1332
01/07/2000 M-1 233 1564
01/08/2000 M-1 219 1783
01/03/2002 M-2 197 197
01/04/2002 M-2 160 357
01/05/2002 M-2 180 537
01/06/2002 M-2 160 697
01/07/2002 M-2 156 853
01/03/2002 M-3 174 174
01/04/2002 M-3 177 352
01/05/2002 M-3 180 531
01/06/2002 M-3 169 700
01/07/2002 M-3 165 865

 

Any help would be greatly appreciated.

Best regards,

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@MarceloSaez 

please try to create a column

Column = SUMX(FILTER('Table','Table'[Name]=EARLIER('Table'[Name])&&'Table'[Date]<=EARLIER('Table'[Date])),'Table'[Oil])

1.PNG 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

amitchandak
Super User
Super User

@MarceloSaez , Try a new column like

cumm_oil = sumx(filter(Table,Table[Date] <= earlier(Table[Date]) && Table[name] =earlier(Table[name])),Table[Oil])

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
amitchandak
Super User
Super User

@MarceloSaez , Try a new column like

cumm_oil = sumx(filter(Table,Table[Date] <= earlier(Table[Date]) && Table[name] =earlier(Table[name])),Table[Oil])

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
ryan_mayu
Super User
Super User

@MarceloSaez 

please try to create a column

Column = SUMX(FILTER('Table','Table'[Name]=EARLIER('Table'[Name])&&'Table'[Date]<=EARLIER('Table'[Date])),'Table'[Oil])

1.PNG 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.