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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aktelidevara
Frequent Visitor

Calculation to start after skipping 12 months and then rolling sum

Hi all,

Out data range is for 48 months. We are trying to calculate the running total that should start from 13th month onward considering last 12 months. And for 14th month (next year) this should have Month 2 to Month 13, so on and so forth. A small excel snippet is below. Can we do this in DAX? Much appreciate your inputs.

Calculation to start after skipping 12 months and then rolling sum

aktelidevara_0-1663870811246.png

aktelidevara_1-1663870819546.png

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1663872436075.png

 

 

Expected result measure: =
VAR _currentmonth =
    MAX ( Data[Month] )
VAR _prev12months = _currentmonth - 12
VAR _monthfilter =
    FILTER (
        ALL ( Data[Month] ),
        Data[Month] >= _prev12months
            && Data[Month] <= _currentmonth - 1
    )
RETURN
    IF ( COUNTROWS ( _monthfilter ) = 12, SUMX ( _monthfilter, [Value measure:] ) )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
aktelidevara
Frequent Visitor

I believe I should post my scenario in more detail where I have one date for each month and the value correspondingly. The month number doesn't exist in real data since it could start anywhere in last 3 years. I will open with correct dataset as a new thread.

But, Thank you @Jihwan_Kim This looks great. I should mark this as solved at least for what I've asked initially. 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1663872436075.png

 

 

Expected result measure: =
VAR _currentmonth =
    MAX ( Data[Month] )
VAR _prev12months = _currentmonth - 12
VAR _monthfilter =
    FILTER (
        ALL ( Data[Month] ),
        Data[Month] >= _prev12months
            && Data[Month] <= _currentmonth - 1
    )
RETURN
    IF ( COUNTROWS ( _monthfilter ) = 12, SUMX ( _monthfilter, [Value measure:] ) )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.