Forum Discussion
Venkata1858
4 years agoNew 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 :
Fact table:
Thanks in advance.
8 Replies
- Ashish_MathurSuper User
- Venkata1858New Member
Hi Ashish_Mathur , Thanks a lot it is working perfect, your response was quicker than escape velocity.
- Ashish_MathurSuper User
You are welcome. Thank you for your kind words.
- Venkata1858New 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_MathurSuper User
Please read up on the AVERAGEX() and DATESBETWEEN() functions. You'll then be able to understand the formula.
- AnonymousNot 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
- Ashish_MathurSuper User
Hi,
Blanks are ignored when calculating averages.