Forum Discussion

smshetty's avatar
smshetty
Frequent Visitor
5 years ago
Solved

Rolling sum

Hi ,   I am looking for a Power BI formula for rolling Sum.   Example: i have 50 Row line items , I need create a rolling sum for every 3 Points .Rolling sum of last 3 transactions (May occur in ...
  • v-xicai's avatar
    5 years ago

    Hi smshetty ,

     

    You may go to Query Editor, go to Add column->Index column (from 1,,), click button "Close & Apply".

     

    Then you may create measure like DAX below.

     

    Rolling 3 rows =
    
    VAR i= SELECTEDVALUE(Table1[Index])
    
    RETURN
    
    CALCULATE (SUM ( Table1[transactions value] ),FILTER ( ALLSELECTED(Table1), Table1[Index] <= i + 2 && Table1[Index] >= i ) )

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

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