Forum Discussion

jimpatel's avatar
jimpatel
Icon for Post Patron rankPost Patron
2 years ago
Solved

3 months rolling sum

Hi,   Thanks for looking at my post. I am looking for some DAX formula for 3 months rolling sum of calculated column please? Any idea please? Thanks a lot  
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi lbendlin ,Thanks for your quick reply, I will add more.

    Hi jimpatel ,

    The Table data is shown below:

    Use the following DAX expression to create columns.

    Column = 
    YEAR('Table'[Date]) * 100 + MONTH('Table'[Date])
    Rank = 
    RANKX('Table',[Column],,ASC,Dense)
    3 months rolling sum = 
    VAR _rank = [Rank]
    VAR _table = SUMMARIZE('Table',[Rank],[Calculated Column])
    RETURN
    SUMX(FILTER(_table,[Rank] <= _rank && [Rank] >= _rank - 2),[Calculated Column])

    Final output

     

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