It seems you've stumble accross quite a few Power BI "gotchas" here when it comes to both the format of the date in your source data and the way you've chosen to display the Date column in your visulaization. But I think I've figured it out. This is my result:
And just to verify some numbers:
(4043 + 20 + 158) / 3 = 1469
(189+ 200 + 207) / 3 = 199
And here are the details:
I used this dataset where I've changed the names slightly to make it easier to write DAX expressions and imported it using Get Data
Date unAcc ACc
01-10-2017 00:00 4043 4043
01-11-2017 00:00 205 4248
01-12-2017 00:00 158 4406
01-01-2018 00:00 142 4548
01-02-2018 00:00 312 4860
01-03-2018 00:00 258 5118
01-04-2018 00:00 176 5294
01-05-2018 00:00 210 5504
01-06-2018 00:00 189 5693
01-07-2018 00:00 200 5893
01-08-2018 00:00 207 6100
And for reasons still uknown to me, I had the same issues as you had with the Date
column. But following some tips from the Power BI community, I created a Date2
like this :
Date2 =
DATE('Table1'[Date].[Year];'Table1'[Date].[MonthNo];1)
Then I calculated the three month average using a
Moving_Average_3_Months =
CALCULATE (
AVERAGEX ( 'Table1'; 'Table1'[unAcc] );
DATESINPERIOD (
'Table1'[Date2];
LASTDATE ( 'Table1'[Date2]);
-3;
MONTH
)
)
Now, if you insert a column chart
and assign Date2
to the Axis
and Moving_Average_3_months
together with unAcc
to Values
, you'll get this:
And that's not what we want. So go to the Visualization settings and change Date2
from Date Hierarchy
to simply Date2
like this:
And that's it:
And here's the whole thing as a table so you can see that the numbers are correct:
In your case, maybe the only thing you have to do is that very last part.
Please don't hesitate to let me know how it works out for you!