Forum Discussion

yodha's avatar
yodha
Helper IV
6 years ago
Solved

Rolling Sum

Hi,

 

I want to calculate Rolling Sum for 3 months, starting form current month to past 2 months.

i have tried : 

Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],LASTDATE('Table'[Date]),-3,MONTH))
Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],MAX('Table'[Date]),-3,MONTH))
Measure = CALCULATE([Count%],DATESINPERIOD('Date'[Date],ENDOFTHEMONTH('Table'[Date]),-3,MONTH))
but none of these are working.

 

Any help on this much appreciated! Thank you.

  • Hi yodha ,

     

    1. Create a relationship between the two tables.

    2. Create a measure like this.

    Measure = 
    CALCULATE(
        SUM('Table'[Count]),
        DATESINPERIOD( 'Date'[Date], MAX('Table'[Date]), -3, MONTH )
    )

    The return value of the current month is equal to the sum of the current month and the previous two months.

     

    Best regards,
    Lionel Chen

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

     

     

     

2 Replies