Rolling average over time with multiple values per date

I’m not sure I completely understood the problem, but to me you just need a standard AVERAGE and not the AVERAGEX iterator.

I’ve changed the formula a bit and didn’t use DATESINPERIOD, this one achieves the same result and (to me) is more clear and readable

Avg =
VAR DaysInterval = 28
RETURN
    CALCULATE (
        AVERAGE ( myTable[Value] ),
        DATESBETWEEN (
            myTable[Date],
            MAX ( myTable[Date] ) - DaysInterval, --from
            MAX ( myTable[Date] ) + DaysInterval  --to
        )
    )

here is the result (based on the sample dataset)

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top