Forum Discussion

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

Calculating 30 days average based on selected date range in date slicer

Dear All,

I would like to calculate the rolling average on per 30 days basis based on the date selected in the data slicer (e..g last 3 months), currently I can display the average on calendar month basis in the matrix and graphs, would appreciate if you can share the right formula for calculating the average on 30 days basis rather than calendar month.

Thanks.

 

Br,

Choo

4 Replies

  • ckhoo2007 , based on what I got.

    If you need the last 30 days cumulative data , you can try a measure like an example

     

    Sum by /30

    Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-30,Day))/30

     

    or

    Rolling average 30 day = CALCULATE(average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-30,Day))

     

    or

     

    measure = averagex(values(Date[Date]), Sales[Sales Amount])

    Rolling average 30 day = CALCULATE([measure],DATESINPERIOD('Date'[Date],max('Date'[Date]),-30,Day))

     

    • ckhoo2007's avatar
      ckhoo2007
      Icon for Helper I rankHelper I

      Thanks Amit, yes I can get the rolling average now.

      Sorry I wasn't explaining the situation clear enough in my post, what I am looking at is displaying 3 values i.e. average of 1-30 days, 31-60 days and 61-90 days? I can take the rolling average above on 30,60 and 90 days but how to put that dimension in the graph/ matrix where I can only select date or month?

       

      Br,

      Choo