Forum Discussion

Venkata1858's avatar
Venkata1858
New Member
4 years ago
Solved

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 :

Fact table: 

 

Thanks in advance.

8 Replies

    • Venkata1858's avatar
      Venkata1858
      New Member

      @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]))
      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

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

  • Anonymous's avatar
    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