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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dunner2020
Post Prodigy
Post Prodigy

Cumulative sum shows value beyond last month

Hi there,

 

I have created a measure that calculates the cumulative sum until last month. Here is my measure:

**bleep** sum =
var CurrentDate = MAX('Outages '[Actual Interruption Start Date Time])
Var lastmonth =EOMONTH(TODAY(),-1)
Var _CYMonth = MONTH(TODAY())
Var _RYMonth = if(_CYMonth > 3 && _CYMonth <= 12, _CYMonth - 3,_CYMonth + 9)

Return
sumx(FILTER(ALL('Outages'),'Outages '[Actual Interruption Start Date Time]<=CurrentDate && 'Outages '[Actual Interruption Start Date Time ] <=lastmonth ),
[sum_measure])
 
The above measure produced the following output
 
:Screenshot 2020-10-27 121153.jpg
 
 
The problem with the above output is that it shows the value of October and November. It should show value up to September.
The expected output would be like:
leo_89_0-1603759135808.png

 

I am not sure where am I making the mistake. Any help would be really appreciated.
 
 
 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Assuming you have dragged Month name from the Calendar Table, this should work

=if(max(calendar[date])>today(),blank(),[your measure])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Assuming you have dragged Month name from the Calendar Table, this should work

=if(max(calendar[date])>today(),blank(),[your measure])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
grandtotal
Resolver III
Resolver III

Check out this method:

https://www.sqlbi.com/blog/marco/2018/08/10/the-hidden-secrets-of-totalytd/

 

You should use the CALCULATE  and  DATESYTD approach.

@grandtotal  I am not interested in calculating DateYTD. I wanted to calculate the cumulative sum by the end of last month.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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