Forum Discussion

AnthNC's avatar
AnthNC
Helper II
2 years ago
Solved

Measure - Rolling average

Hi everyone!   Can you help me out with a rolling (or moving ?) average formula please ? Here is the pbix file :https://drive.google.com/file/d/1tD0vPXoF9NbRuan487Rv9wdFiCuneq7v/view?usp=sharing  ...
  • danextian's avatar
    2 years ago

    hI AnthNC ,

     

    As one of the best practices, create a separate calendar/dates table. Relate that to your fact table and create this measure:

    Avg Balance R3M = 
    CALCULATE (
        AVERAGEX ( ALL ( 'Calendar'[Year], 'Calendar'[Month] ), [Balance] ),
        DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), - 3, MONTH )
    )
    

    Please attached file for the details and to this link for further explanation -https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/