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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Venkata1858
New Member

Rolling 5 weeks average

Hi,

I'm new to power bi, I need to calculate rolling 5 weeks average for my weekly sales data, I tried in multiple ways but I'm getting wrong output can some one help me please. below is the data I have.

 

Date Dimension :

Venkata1858_0-1652236685220.png

Fact table: 

Venkata1858_1-1652236808318.png

 

Thanks in advance.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Ashish/Venkata, would this solution work if you didn't have sales in every week but wanted to calculate rolling average regardless? Thank you

Hi,

Blanks are ignored when calculating averages.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur, May I know how this DAX works 

5 weeks rolling average sales = if(isblank([Sales]),blank(),AVERAGEX(DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date])-34,Min('Calendar'[Date])),[Sales]))

Please read up on the AVERAGEX() and DATESBETWEEN() functions.  You'll then be able to understand the formula.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sure Ashish

Hi @Ashish_Mathur , Thanks a  lot it is working perfect, your response was quicker than escape velocity.

You are welcome.  Thank you for your kind words.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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