Forum Discussion
roalisco
1 year agoFrequent Visitor
YoY % variation based on selected year
Hi, I have a DAX measure called '4w_roll_avg' that calculates the 4 week rolling average. I want to create another measure that calculates the YoY % variation based on the selection of a base...
- Anonymous1 year ago
Hi roalisco ,
Here are the steps you can follow:
1. Create measure.
Measure = var _select=[Base YoY comparison Value] var _table= SUMMARIZE(ALL('Table'),[Date],"4w_roll_avg",[4w_roll_avg]) var _selectsum= SUMX( FILTER(_table,YEAR('Table'[Date])=_select&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[4w_roll_avg]) return IF( YEAR(MAX('Table'[Date]))>_select, DIVIDE( [4w_roll_avg]-_selectsum,_selectsum))2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
1 year agoNot applicable
Hi roalisco ,
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=[Base YoY comparison Value]
var _table=
SUMMARIZE(ALL('Table'),[Date],"4w_roll_avg",[4w_roll_avg])
var _selectsum=
SUMX(
FILTER(_table,YEAR('Table'[Date])=_select&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[4w_roll_avg])
return
IF(
YEAR(MAX('Table'[Date]))>_select,
DIVIDE(
[4w_roll_avg]-_selectsum,_selectsum))
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly