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
bazzel
Regular Visitor

4 Week Rolling Average Based on Week Number

Hi,

 

I am trying to calculate a rolling 4 week average using the [Week Number] and [Year].  The measure that I need to average is [#Orders].  Ideally I would like this measure to calculate the average of the current [Week Number] which is 33 below, and the Previous 3 Weeks.  For example, see below.

PBI.PNG

 

 

 

 

 

 

 

 

 

 

 

# FourWeekTotal = CALCULATE(COUNTROWS('#Orders'),Filter(ALL('Merged Dataset'), 'Merged Dataset'[Week Number]=max('Merged Dataset'[Week Number])

|| 'Merged Dataset'[Week Number] = MAX('Merged Dataset'[Week Number])-1

|| 'Merged Dataset'[Week Number] = MAX('Merged Dataset'[Week Number])-2

|| 'Merged Dataset'[Week Number] = MAX('Merged Dataset'[Week Number])-3))

 

Above, is my attempt at calculating the last four week rolling average but I am currently getting the wrong count.  I have used a slicer to filter the calculation by [Year] for time  being untill I get the above correct.  Any help would be greatly appreciated as calculations using Working Weeks (Monday-Sunday) are not supported which is a nuisence.  

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @bazzel

 

You may try to use AVERAGEX(SUMMARIZE(...)) to get the average from the SUMMARIZE Table.

 

Regards,

Cherie

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.