Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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
Solved! Go to Solution.
@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])))
@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])))
Amazing! I had to make a couple of slight edits using SELECTEDVALUE instead of MAX but got it working 🙂
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |