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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
lg01
Advocate II
Advocate II

Running total per category and date

I have the data below. I need to add a calculated column (or Measure) to get the running total of MaxPerMonth based on the year (Date) and the FacilityName. In other words, I need it to restart for each new year and also each Facility. So it will restart when it find a new facility or a new year in a facility. I tried several Iterations of this to no avail. Any ideas how to resolve this would be appreciated:

 

CALCULATE(sum('Table'[MaxPerMonth]),filter(Allexcept('Table','Table'[FacilityName]), 'Table'[Date] <= Earlier('Table'[Date]) ))

 

DateFacilityNameMaxProductionMinProductionMaxPerMonth
1/1/2024 0:00Facility1152051047120
2/1/2024 0:00Facility1152051044080
3/1/2024 0:00Facility1152051047120
4/1/2024 0:00Facility1152051045600
5/1/2024 0:00Facility1152051047120
6/1/2024 0:00Facility1152051045600
7/1/2024 0:00Facility1152051047120
8/1/2024 0:00Facility1152051047120
9/1/2024 0:00Facility1152051045600
10/1/2024 0:00Facility1152051047120
11/1/2024 0:00Facility1152051045600
12/1/2024 0:00Facility1152051047120
1/1/2025 0:00Facility11393.638305.17543202.778
2/1/2025 0:00Facility11393.638305.17539021.864
3/1/2025 0:00Facility11393.638305.17543202.778
4/1/2025 0:00Facility11393.638305.17541809.14
5/1/2025 0:00Facility11393.638305.17543202.778
6/1/2025 0:00Facility11393.638305.17541809.14
7/1/2025 0:00Facility11393.638305.17543202.778
8/1/2025 0:00Facility11393.638305.17543202.778
9/1/2025 0:00Facility11393.638305.17541809.14
10/1/2025 0:00Facility11393.638305.17543202.778
11/1/2025 0:00Facility11393.638305.17541809.14

 

The result will look like this:

 

DateFacilityNameMaxProductionMinProductionMaxPerMonthRunningTotalPerFacilityMonth
1/1/2024 0:00Facility115205104712047120
2/1/2024 0:00Facility115205104408091200
3/1/2024 0:00Facility1152051047120138320
4/1/2024 0:00Facility1152051045600183920
5/1/2024 0:00Facility1152051047120231040
6/1/2024 0:00Facility1152051045600276640
7/1/2024 0:00Facility1152051047120323760
8/1/2024 0:00Facility1152051047120370880
9/1/2024 0:00Facility1152051045600416480
10/1/2024 0:00Facility1152051047120463600
11/1/2024 0:00Facility1152051045600509200
12/1/2024 0:00Facility1152051047120556320
1/1/2025 0:00Facility11393.638305.17543202.77843202.778
2/1/2025 0:00Facility11393.638305.17539021.86482224.642
3/1/2025 0:00Facility11393.638305.17543202.778125427.42
4/1/2025 0:00Facility11393.638305.17541809.14167236.56
5/1/2025 0:00Facility11393.638305.17543202.778210439.338
6/1/2025 0:00Facility11393.638305.17541809.14252248.478
7/1/2025 0:00Facility11393.638305.17543202.778295451.256
8/1/2025 0:00Facility11393.638305.17543202.778338654.034
9/1/2025 0:00Facility11393.638305.17541809.14380463.174
10/1/2025 0:00Facility11393.638305.17543202.778423665.952
11/1/2025 0:00Facility11393.638305.17541809.14465475.092
2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@lg01 

you can try this

 
Column = sumx(FILTER('Table','Table'[Date]<=EARLIER('Table'[Date])&&'Table'[FacilityName]=EARLIER('Table'[FacilityName])&&'Table'[MaxProduction]=EARLIER('Table'[MaxProduction])),'Table'[MaxPerMonth])
 
11.png
 
 

 





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

Proud to be a Super User!




View solution in original post

v-karpurapud
Community Support
Community Support

Hi @lg01 

Could you please confirm if your query have been resolved the solution provided by @ryan_mayu ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

Thank you

View solution in original post

2 REPLIES 2
v-karpurapud
Community Support
Community Support

Hi @lg01 

Could you please confirm if your query have been resolved the solution provided by @ryan_mayu ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

Thank you

ryan_mayu
Super User
Super User

@lg01 

you can try this

 
Column = sumx(FILTER('Table','Table'[Date]<=EARLIER('Table'[Date])&&'Table'[FacilityName]=EARLIER('Table'[FacilityName])&&'Table'[MaxProduction]=EARLIER('Table'[MaxProduction])),'Table'[MaxPerMonth])
 
11.png
 
 

 





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

Proud to be a Super User!




Helpful resources

Announcements
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.

May 2025 Monthly Update

Fabric Community Update - May 2025

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