Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
himanshu56
Resolver II
Resolver II

Cumulative Total/Rolling Sum Last 12 months

Hi All,

 

I have a requirement where in I have to show rolling 12 month sum against a date column.

 

I have mentioned the requirement in the below table.

 

Need: I need a DAX which gives me the expected result as mentioned below. Please note: I want this as a column and not as a measure

Requirement:  For any given month, I need addition of that month's YTD count till YTD counts of -11 months

Please have a look at the table below to understand the requirement.

 

@amitchandak  @mahoneypat 

YearMonth (Date Format)YTD ( This is a column. Not a measure)Expected Result ( As a calculated Column not a measure)
Jan-18253253
Feb-18202253+202
Mar-18238238+202+253
Apr-18206and so on till Dec-18
May-18240 
Jun-18237 
Jul-18271 
Aug-18245 
Sep-18214 
Oct-18270 
Nov-18243 
Dec-18206 
Jan-19260But from here onwards it should give addition of 260(which is Jan 19 YTD) count all the way till 202 (which is Feb 18 YTD count)
Feb-19226Similarly here addition of 226 (Feb 19 YTD) all the way till 238 ( March -18)
Mar-19237237 till 206
Apr-19229and so on
May-19260till end of data
Jun-19215 
Jul-19225 
Aug-19240 
Sep-19202 
Oct-19240 
Nov-19235 
Dec-19225For eg. Here addition of 225 + 235+240+202+240+225+215+260+229+237+226+260. 260 being Jan19 count
Jan-20237 
Feb-20264 
Mar-20266Basically sum of this months data till -11 months.
Apr-20260 
May-20229 
Jun-20231 
Jul-20237 
Aug-20226 
Sep-20219 
Oct-20201 
Nov-20212 
Dec-20234 
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @himanshu56 ,

First, please create a date dimension table Calendar.

Calendar = CALENDARAUTO()

Then create a calculated column as below:

Rolling Sum Last 12 months =
CALCULATE (
    SUM ( 'Table'[YTD] ),
    ALL ( 'Table' ),
    DATESBETWEEN (
        'Calendar'[Date],
        DATEADD ( LASTDATE ( 'Calendar'[Date] ), -11, MONTH ),
        LASTDATE ( 'Calendar'[date] )
    )
)

Rolling Sum Last 12 month.JPG

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

View solution in original post

2 REPLIES 2
himanshu56
Resolver II
Resolver II

It worked like a charm. Thanks a lot for your help on this

v-yiruan-msft
Community Support
Community Support

Hi @himanshu56 ,

First, please create a date dimension table Calendar.

Calendar = CALENDARAUTO()

Then create a calculated column as below:

Rolling Sum Last 12 months =
CALCULATE (
    SUM ( 'Table'[YTD] ),
    ALL ( 'Table' ),
    DATESBETWEEN (
        'Calendar'[Date],
        DATEADD ( LASTDATE ( 'Calendar'[Date] ), -11, MONTH ),
        LASTDATE ( 'Calendar'[date] )
    )
)

Rolling Sum Last 12 month.JPG

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.