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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Cumulative sum

Hello, I've been having a problem I tell you.

I have this table that is a forecast, so I would like to have a measure that adds the accumulated month by month of the quantity column but stops the sum in the previous month closed (that is, if today is May 5, I add until April 30 and so May 15 I continue adding until April 30 and just when it is June, I join until May 31), I do not know if it is possible.


Thank you

DPalaciosW_0-1683279138853.png

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1683513505507.png

Please try:

Cumulative sum = 
var _a = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Date]<=EOMONTH(MAX('Table'[Date]),0)))
var _b = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Date]<=EOMONTH(MAX('Table'[Date]),-1)))
return IF(MONTH(MAX('Table'[Date]))=MONTH(TODAY()),_b,_a)

Final output:

vjianbolimsft_1-1683513842778.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1683513505507.png

Please try:

Cumulative sum = 
var _a = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Date]<=EOMONTH(MAX('Table'[Date]),0)))
var _b = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Date]<=EOMONTH(MAX('Table'[Date]),-1)))
return IF(MONTH(MAX('Table'[Date]))=MONTH(TODAY()),_b,_a)

Final output:

vjianbolimsft_1-1683513842778.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.