Forum Discussion

mdbuzzer's avatar
mdbuzzer
Icon for Helper I rankHelper I
5 years ago
Solved

How do you calculate the rolling average per week/month?

I have bins created from my date field which gets the daily group.  Is there a way to calculate the weekly average, so for example from April 1st to April 7th it should have an average of 16.2 (excl...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi mdbuzzer ,

     

    1.Create three calculated columns.

    weeknum = WEEKNUM([Date],2)
    Average = CALCULATE(AVERAGE('Table'[Value]),ALLEXCEPT('Table','Table'[weeknum]))
    week = WEEKDAY([Date],2)

     

    2.Create a new table and create a relationship with main table.

    Table 2 = FILTER('Table',[week]=3)

     

     

    3.Create a calculated column in the new table.

    Rolling average = CALCULATE(SUM('Table 2'[Average]),FILTER(ALL('Table 2'),[Date]<=EARLIER('Table 2'[Date])))

     

    4.The result is as follows.

     

    You can check more details from here.

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.