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
yasbos
Resolver I
Resolver I

Cumulative Month Total YoY

Hello, Team. I've been struggling with this. I need to calculate the cumulative month total for the current year and for the previous year and present them on the same graph. My problem is that when I present the data, somehow the graph shows data for future dates for the current month. I don't understand why. Today is the 6th of the month, so I have data until the 5th of the month. Therefore, the blue line should stop at the 5th. The numbers from the 1st until the 5th of the month are correct. However, I don't understand where it gets the numbers for the future dates. Thanks!

yasbos_0-1659836478496.png

 

1 ACCEPTED SOLUTION

Hi, @yasbos 

Try this: 

MaxDate=CALCULATE(max(Sales_Fact[Sale Date]), REMOVEFILTERS('Calendar'[Date]))

 




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


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ribisht17
Super User
Super User

Ok, now ... the plot thickens 🙂 I reviewed your referred solution, and I had everything set up properly. I even had tried several variations--all to no avail, and that's what was frustrating. Something strange happened just now, though: I have a measure, Current_Date, in my calendar table. What it does is it gets the max of the dates in my sales fact table, and that is the date that I used as a condition.

MaxDate=max(Sales_Fact[Sale Date])
calculate(Sales_Fact[Sales MTD],'Calendar'[Date]<=MaxDate)
That was not working. When I set MaxDate to equal today(), instead of max(Sales_Fact[Sale Date]), everything worked perfectly! I switch back to maxdate, it gives me these phantom numbers again for the remainder of the month. This is just kooky! Below is the correct result -- after I replaced maxdate with today(). 
yasbos_0-1659846005434.png

 


Hi, @yasbos 

Try this: 

MaxDate=CALCULATE(max(Sales_Fact[Sale Date]), REMOVEFILTERS('Calendar'[Date]))

 




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


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




If anyone knows why it worked with removefilters, that would save me from the straightjacket. Thanks.

OMG, @ALLUREAN ! That worked. I have NO IDEA what just happened, though. Thanks so much. Thanks to @ribisht17 , too, for responding.

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.