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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bosleyjarrett
Frequent Visitor

Calculating Moving 90 Day sum and plotting on time graph

Hello,

 

I am trying to calculate a moving 90 day sum that I am then plotting on a graph with the actual months (think June has June, May & April data, May has March, April, and May data etc). My data set is cost data for each product for each month with a number of other measures. I have been attempting this through various versions of the "Calculate(,FILTER( or Calculate(,DatesBetween(" functions with no luck. Has anyone done this before? I also tried calculating a number of custom columns where I would sum the previous month and the month before and add the columns together but that did not work either.

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @bosleyjarrett

 

This should be close and works for me.  This calculated measure assumes a relationship between the Sales and Dates tables.

 

 

Measure = CALCULATE(
                    SUM('Sales'[Sales Qty]),
		    -------------------------------------------------------------------------
	            DATESINPERIOD('Dates'[Date],LASTDATE('Dates'[Date]),-90,DAY)
		  )

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @bosleyjarrett

 

This should be close and works for me.  This calculated measure assumes a relationship between the Sales and Dates tables.

 

 

Measure = CALCULATE(
                    SUM('Sales'[Sales Qty]),
		    -------------------------------------------------------------------------
	            DATESINPERIOD('Dates'[Date],LASTDATE('Dates'[Date]),-90,DAY)
		  )

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

That looks to have worked! Thanks Phil!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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