Forum Discussion
PB_MZ
3 years agoRegular Visitor
Trailing 6 months average
Hi, I would like to calculate the trailing 6 month average for Margin % (A), Margin % (B), Margin % (C). They are measures instead of columns. I tried several ways but none of them worked for...
Anonymous
3 years agoNot applicable
Hi PB_MZ ,
I think you can refer to below code to create measures.
Trailing 6 months average for Margin % (A) =
VAR _EndDate =
MAX ( DimDate[Date] )
VAR _StartDate =
EOMONTH ( _EndDate, -7 ) + 1
RETURN
AVERAGEX (
FILTER (
ALL ( DimDate ),
DimDate[Date] >= _StartDate
&& DimDate[Date] <= _EndDate
),
[Margin % (A)]
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PB_MZ
3 years agoRegular Visitor
This is the results I would like to get.