I have a table (TableA), one of the columns is called DateAdded
which is a Date timestamp, the table has multiple rows entered into it per day. In PowerBI, I have set this table up with a relationship to a date table (Dates). If I add TableA to a simple list view and place a date range slicer on the page, all works as expected (TableA gets filtered down based on date selection) - this proves the relationship works.
What I would like to do is add a rolling average in a chart based off the number of rows added per day.
TableA
Date...............| Product...............
2021-07-10 | Reference 1
2021-07-10 | Reference 2
2021-07-10 | Reference 3
2021-07-11 | Reference 4
2021-07-11 | Reference 5
2021-07-12 | Reference 6
2021-07-13 | Reference 7
2021-07-13 | Reference 8
2021-07-13 | Reference 9
2021-07-13 | Reference 10
The expected output is
Date...............| Rolling Average...............
2021-07-10 | 3
2021-07-11 | 2.5
2021-07-12 | 2
2021-07-13 | 2.5
Here is my current DAX, but it is returning exactly the same as the regular count, as opposed to a rolling average.
Rolling Average =
AVERAGEX(
FILTER( ALLSELECTED(Dates),
Dates[Date] <= MAX(Dates[Date])),
COUNT('TableA'[Product])
)
Where am I going wrong?
Thanks.