Hi,
I have written a measure in DAX to calculate the turnover of the past 12 months (Rolling 12 months) per customer:
CALCULATE([Turnover];
FILTER(ALL(T_Calendar);
T_Calendar[MonthNumber]=MONTH(TODAY())-1&&T_Calendar[Year]=YEAR(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-2&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-3&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-4&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+1&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+2&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+3&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+4&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+5&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+6&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+7&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+8&&T_Calendar[Year]=Year(TODAY())-1))
Is there a way to write this more efficiently? I have to adjust this monthly.
Thanks in advance!
I have written a measure in DAX to calculate the turnover of the past 12 months (Rolling 12 months) per customer:
CALCULATE([Turnover];
FILTER(ALL(T_Calendar);
T_Calendar[MonthNumber]=MONTH(TODAY())-1&&T_Calendar[Year]=YEAR(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-2&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-3&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())-4&&T_Calendar[Year]=Year(TODAY())
||T_Calendar[MonthNumber]=MONTH(TODAY())&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+1&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+2&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+3&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+4&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+5&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+6&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+7&&T_Calendar[Year]=Year(TODAY())-1
||T_Calendar[MonthNumber]=MONTH(TODAY())+8&&T_Calendar[Year]=Year(TODAY())-1))
Is there a way to write this more efficiently? I have to adjust this monthly.
Thanks in advance!