Forum Discussion
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
Hi Syndicate_Admin ,
Based on your description, I have created a simple sample:
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:
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.
1 Reply
- v-jianboli-msftCommunity Support
Hi Syndicate_Admin ,
Based on your description, I have created a simple sample:
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:
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.