March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to create a rolling 4 week average of the Actuals column and grouped on the State.
So startring at the bottom, the 4 week average for TX in the final row would be, (1+ 0 (no sales in week of may22) + 1+3) / 4 (number of weeks).
So in think for a given week and state observation, i would need to sum all 'Actual' values in a 4 week period including the current obersation, grouped by the State, then divide by the number of weeks.
Solved! Go to Solution.
Hi @Jacob1832 ,
Please try this measure.
Rolling 4 week average of the Actuals =
VAR _given_week =
MAX ( 'Table'[Week] )
VAR _sum =
CALCULATE (
SUM ( 'Table'[Actuals] ),
'Table'[Week] >= _given_week - 21
&& 'Table'[Week] <= _given_week
)
VAR _average =
DIVIDE ( _sum , 4 ) + 0
RETURN
_average
Attached PBIX file for reference.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi @Jacob1832 ,
Please try this measure.
Rolling 4 week average of the Actuals =
VAR _given_week =
MAX ( 'Table'[Week] )
VAR _sum =
CALCULATE (
SUM ( 'Table'[Actuals] ),
'Table'[Week] >= _given_week - 21
&& 'Table'[Week] <= _given_week
)
VAR _average =
DIVIDE ( _sum , 4 ) + 0
RETURN
_average
Attached PBIX file for reference.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |