I got this awesome code from Phils Blog for Row Based Time Intelligence Slicer for Custom Period [Pased Bellow].
Now i need to come up with a code that will also include MAT [Moving Anual Total],
Time Intelligence =
VAR Today = MAX('Dim_Calendar'[Date])
VAR ThisYear = YEAR(Today)
VAR ThisMonth = MONTH(Today)
VAR ThisDay = DAY(Today)
RETURN
SELECTCOLUMNS(
UNION
(
// Last 3 Months
ADDCOLUMNS(
GENERATE(
SELECTCOLUMNS({"Last 3 Months"},"Period",[Value]) ,
GENERATESERIES(
DATE(ThisYear , ThisMonth - 3 , 1) ,
Today
)
),"Axis Date",[Value]),
// Last 6 Months
ADDCOLUMNS(
GENERATE(
SELECTCOLUMNS({"Last 6 Months"},"Period",[Value]) ,
GENERATESERIES(
DATE(ThisYear , ThisMonth - 6 , 1) ,
Today
)
),"Axis Date",[Value]),
// Current Year
ADDCOLUMNS(
GENERATE(
SELECTCOLUMNS({"Current Year"},"Period",[Value]) ,
GENERATESERIES(
DATE(ThisYear , 1 , 1) ,
Today
)
),"Axis Date",[Value]),
// Prior Year
ADDCOLUMNS(
GENERATE(
SELECTCOLUMNS({"Prior Year"},"Period",[Value]) ,
GENERATESERIES(
DATE(ThisYear-1 , 1 , 1) ,
DATE(ThisYear,ThisMonth-12,ThisDay)
)
),
"Axis Date",DATE(YEAR([Value]),MONTH([Value])+12,DAY([Value])
)
),
// Totals YTD
GENERATE(
SELECTCOLUMNS({"Totals YTD"},"Period",[Value]) ,
VAR BaseTable =
SELECTCOLUMNS(
GENERATESERIES(
DATE(ThisYear , 1 , 1) ,
Today
),"D1",[Value]
)
RETURN
SELECTCOLUMNS(
GENERATE(
BaseTable ,
FILTER(
SELECTCOLUMNS(BaseTable,"D2",[D1]) ,[D2]<=EARLIER([D1]))
)
,"Date",[D2]
,"Axis Date",[D1]
)
)
) ,
"Date" , [Value] ,
"Period" , [Period] ,
"Axis Date" , [Axis Date]
)