Forum Discussion

NicoleApple's avatar
NicoleApple
New Member
4 years ago
Solved

7 day moving average

I am trying to urgently calculate a 7 day moving a average but im having issues. I could do it in Excel but i want to use Power BI to present the data instead and my DAX is a little rusty as i havent...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    I do not fully understand the DAX formula, but I think it has to have one more  )  at the end of the formula.

     

     

    7 day moving average =
    CALCULATE (
        SUM ( 'PCR TEsting Data'[Total Volume of Tests (Excl. work in progress or tests referred out) (No.)] ) / 7,
        DATESINPERIOD (
            'PCR TEsting Data'[Relevant Date],
            LASTDATE ( 'PCR TEsting Data'[Relevant Date] ),
            -7,
            DAY
        )
    )