Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
Hi,
Wondering if anyone can help me improve my rolling average formula - I've got data that runs from 1 Jan 2020 to 31 July 2020 & I've created a 6 week rolling average using the below formula
Is there a better formula I can use so the first 6 weeks are not being underreported - so ideally the first week is just a rolling average of that week and the second is for the first 2 weeks - and so on. Thanks in advance
Laurence
Solved! Go to Solution.
Your formula is great, but you have hard coded 42 days. But you don't have 42 days when the time period is in the first 41 days of data. Write a test measure that counts the days, eg countrows(DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -42, DAY ))
and add it to the visual. I hope it will tell you how many days you are tracking. Then divide by this instead of 42.
Another approach would be to use AVERAGEX, which should keep the numerator and denominator in sync.
Revs R42DA =
AVERAGEX (
DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -42, DAY ),
[Revenue]
)
This is simpler but less computationally efficient than methods that don't require calculating Revenue for each day in the period separately.
Thank you both @AlexisOlson & @MattAllington both solutions have worked perfectly - thank you
Another approach would be to use AVERAGEX, which should keep the numerator and denominator in sync.
Revs R42DA =
AVERAGEX (
DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -42, DAY ),
[Revenue]
)
This is simpler but less computationally efficient than methods that don't require calculating Revenue for each day in the period separately.
Your formula is great, but you have hard coded 42 days. But you don't have 42 days when the time period is in the first 41 days of data. Write a test measure that counts the days, eg countrows(DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -42, DAY ))
and add it to the visual. I hope it will tell you how many days you are tracking. Then divide by this instead of 42.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
147 | |
85 | |
66 | |
52 | |
46 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |