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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AdamRobC
Helper II
Helper II

Calculating a dynamic 6 week run rate

Hi,

I want to calculate a 6 week run rate measure that, based on a selected week, looks back at the previous 6 weeks and calculates the average for that measure.

E.g. if Week Index = 10 then the DAX would filter for all values in weeks 4 - 9 and divide by 6. This would be dynamic so whatever week I select it filters for the previous 6 weeks based on the index.

Any ideas?

Thanks,

Adam

 

AdamRobC_0-1621285527371.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@AdamRobC , a measure like

 

Last 6 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week index]>=max('Date'[Week index])-6 && 'Date'[Week index]<=max('Date'[Week index]))) /6

 

 

or

 

 

Last 6 weeks = CALCULATE(averageX(values('Date'[Week index]) , 'order'[Qty]), FILTER(ALL('Date'),'Date'[Week index]>=max('Date'[Week index])-6 && 'Date'[Week index]<=max('Date'[Week index])))

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@AdamRobC , a measure like

 

Last 6 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week index]>=max('Date'[Week index])-6 && 'Date'[Week index]<=max('Date'[Week index]))) /6

 

 

or

 

 

Last 6 weeks = CALCULATE(averageX(values('Date'[Week index]) , 'order'[Qty]), FILTER(ALL('Date'),'Date'[Week index]>=max('Date'[Week index])-6 && 'Date'[Week index]<=max('Date'[Week index])))

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

 

Amazing! I had to make a couple of slight edits using SELECTEDVALUE instead of MAX but got it working 🙂

 

6 Week Run Rate Visits = CALCULATE([Visits],FILTER(ALL('Calendar'),'Calendar'[Week Index]>=SELECTEDVALUE('Calendar'[Week Index])-6 && 'Calendar'[Week Index]<=SELECTEDVALUE('Calendar'[Week Index])-1))/6

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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