Hi,
The formula works fine, it is the context you need to see. This MA set off against DAY will show the moving average sales per day over the months. Change your formula as below, DAY instead of Month and place in the table, you will see the correct MA.
PL Sales 3Days MA = AVERAGEX (DATESINPERIOD( Dates[Date]; MAX(Dates[Date] ); -3; DAY ); [Total Sales] )
One thing to keep in mind is what happens if there is a date that has no sales. If you use DATESINPERIOD it will count that as zero and use that in the average, which would skew it. There’s ways to account for that, but if there are sales on everyday then using the builtin time intelligence functions work great.
HI Nick , Thank you . I did try the inbuilt Rolling Average Function , i did set my date table as date table , however got this "Only PBI - supported date hierarchies are supported .
Odd, never seen before, It did not happen when I checked whether it was and it was marked as date table. Made a slight change to the date table, adding a column with month&year starting on 1-1-2012 . I do recall that at the time of certification some issues with the date query script forced me to create my own.
I manage to get the table to be mark as date table , the Only PBI - supported date hierarchies are supported is pop up when i use the new measure to create rolling average
You’re getting this error because quick measures required the in-built heirarchy from a date table.
This is explained here.
I just don’t recommend using quick measures. Learning DAX is the key. Everything you could possibly want to do is easy enough to create just by writing out DAX.