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
ShemRo
Regular Visitor

Cumulative Sum not working??

Hi There,

I have the below dataset.

ShemRo_0-1636757457660.png

I am wanting to calculate a cumulative total of the act column. I am making a mistake in my calculated column somwhere in the code:

Cumulative_Act_Hours_Col = CALCULATE(SUM('Table'[act]),Filter(All('Table'[MonthYear]),'Table'[MonthYear]<=EARLIER('Table'[MonthYear])))

 

Any helpwould be greatly appreciated. I have done similar formulas before but this one has got me stumped.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Oh Ok.

Have you tried this:

Cumulative_Act_Hours_Col =
CALCULATE(
SUM( 'Table'[act] ),
FILTER( ALL( 'Table' ), 'Table'[MonthYear] <= EARLIER( 'Table'[MonthYear] ) )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

6 REPLIES 6
VahidDM
Super User
Super User

Hi @ShemRo 

 

What is your "MonthYear" column format? it seems it's not date/time!

Check that and then if it's not Date format change that to Date format and check your formula again.

 

Cumulative_Act_Hours_Col = CALCULATE(SUM('Table'[act]),Filter(All('Table'),'Table'[MonthYear]<=EARLIER('Table'[MonthYear])))

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

That it what i orginally thought too but...

ShemRo_0-1636764075621.png

regards Shem

Oh Ok.

Have you tried this:

Cumulative_Act_Hours_Col =
CALCULATE(
SUM( 'Table'[act] ),
FILTER( ALL( 'Table' ), 'Table'[MonthYear] <= EARLIER( 'Table'[MonthYear] ) )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Ahh yes!!! Thanks so much. This got it. it was the 'Table' after the ALL that i had incorrect.

 

Thank you so much!!

 

Anonymous
Not applicable

This is quick and simple. 

cumulativeAmt = VAR _dateScope=MAX('Table'[dt])
return CALCULATE(SUM([act]),ALL('Table'),'Table'[dt]<=_dateScope)

 

skeets20_0-1636758466437.png

 

Thanks @Anonymous 

..Hmm... something is off as mine only sum and dont accumulate:

ShemRo_1-1636761838205.png

 

 

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.