Forum Discussion

AOD's avatar
AOD
Icon for Helper III rankHelper III
5 years ago
Solved

7 Days Rolling calculation

Hi All, 

 

Need help in calculating 7 days rolling DAX formula based on Value field.

Thanks in advance for helping.

 

 

  • Hi AOD 

     

    It depends what you want to achieve, but you can use dateadd, datesinperiod, etc functions for getting your results.

     

    Thanks,

    Ankit

3 Replies

  • AOD , with help from a date table

     

    Rolling 7 days = CALCULATE(sum(Sal[Sales Amount]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-7,Day))

    or

    Rolling 7 days = CALCULATE(sum(Sal[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-7,Day))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

  • Hi AOD 

     

    It depends what you want to achieve, but you can use dateadd, datesinperiod, etc functions for getting your results.

     

    Thanks,

    Ankit

    • AOD's avatar
      AOD
      Icon for Helper III rankHelper III
      Thanks. Got it resolved with below DAX
      Moving sum = CALCULATE(SUM(Sheet1[Value ]),
      DATESINPERIOD(Sheet1[Column3],LASTDATE(Sheet1[Column3]),-7,DAY)
      )