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 everyone, I'm fairly new to DAX so I could use all the help I can get here. I found the DAX definition for Moving/Rolling Average as below :
Solved! Go to Solution.
Hi, @theDarkPrince
please try the below measure.
Rolling Average =
VAR LastDate_ =
LASTDATE ( Query1[date] )
RETURN
IF (
ISBLANK (
CALCULATE (
SUM ( Query1[OI_Prediction_Month] ),
DATEADD ( Query1[date], -3, MONTH )
)
),
BLANK (),
CALCULATE (
AVERAGEX (
VALUES ( 'Calendar'[MonthInCalendar] ),
CALCULATE ( SUM ( Query1[OI_Prediction_Month] ) )
),
FILTER (
ALL ( Query1 ),
Query1[date] <= LastDate_
&& Query1[date] > DATEADD ( LastDate_, -3, MONTH )
)
)
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @theDarkPrince
please try the below measure.
Rolling Average =
VAR LastDate_ =
LASTDATE ( Query1[date] )
RETURN
IF (
ISBLANK (
CALCULATE (
SUM ( Query1[OI_Prediction_Month] ),
DATEADD ( Query1[date], -3, MONTH )
)
),
BLANK (),
CALCULATE (
AVERAGEX (
VALUES ( 'Calendar'[MonthInCalendar] ),
CALCULATE ( SUM ( Query1[OI_Prediction_Month] ) )
),
FILTER (
ALL ( Query1 ),
Query1[date] <= LastDate_
&& Query1[date] > DATEADD ( LastDate_, -3, MONTH )
)
)
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi Jihwan, much thanks. 😊 Once I read you DAX code, it came to me that the solution's quite simple. Guess I need more practice with DAX to catch up.
User | Count |
---|---|
117 | |
75 | |
61 | |
50 | |
44 |
User | Count |
---|---|
175 | |
125 | |
60 | |
60 | |
58 |