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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Zarlot531
Helper V
Helper V

Rolling sum line graph won't segregate months as separate lines

So there are two images here. The second image shows roughly what I'm trying to create. 

 

THe first image shows some of the struggles I'm having. I have a dataset that gives me actual orders by day. I've used a union query to drop on top of that the budget orders, but that's a separate issue right now. 

 

I am struggling to get the rolling orders to separate by month. If you see the Power BI image below, what it's doing is summing everything in the whole "actual" dataset and not just in the relevant month. The monthly sum amounts should be growing to $60,000 - $100,000 or so, not millions. And the Jan and Feb line is put right on top of each other in this image. I do also have a "date" table with all the relevant dates (2019-2020) included. Any ideas? thanks. 

 

Capture333.JPG

 

Capture4445.JPG

6 REPLIES 6
amitchandak
Super User
Super User

@Zarlot531, You can create a MTD measure and plot it by month year. Use date Calendar and have you month year there.

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I've actually made some progress going down a slightly different path, but now I'd like to use an IF statement to stop the line, at, say, 30 days for months with 30 days in them. I realize this isn't the most elegant way to do this, but I for some reason I can't get the IF statement to see my "DayMonth" (days in the month) field. "DayMonth" is the number of days in the month. It's a column repeated with that value for each record. 

Capture55.JPG

Capture677.JPG

Ok, let me try to clean this up a bit/make things easier. I've attached a link to the file. 

 

I have managed to get the rolling part working, but I'd like to be able to stop it at the end of the month, the 28th or 29th for Feb, 30th or 31st for other months. I'd also like to stop it at the current day we're actually on, using some sort of getdate(). Below is the link, any help is appreciated. I guess also one other thing is I need the budget to be able to be selected as well, which I will try to play with some on my own tomorrow. 

 

LInk to FIle  

OK, so I figured out how to make the months stop at the right day. Only main issue now is I can't seem to get the "budget" line in at the same time as the actual line...like, I'd like to show the budget for March at the same time I'm showing the actual. Capture89.JPG

This is where I'm at now... The "month lag" tables simply have (or will have) 1-31, 1-29, 1-30, 1-28. But when I try to test with 29, the Feb line goes flat..hmmm

 

Capture555.JPG

Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors