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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Nagesh_01
Frequent Visitor

Calculate Cumulative total from December to December. Example, From Dec'2020 to Dec'2021 Cumulative

Hi, 
Could someone please help me on this DAX? I need to calculate YTD/Cumulative total from December to December which means Previous year's Last month (December) to next year's last moth (December). Example Dec'2020 to Dec'2021. 

Please find below example in spreadsheet. Please help to calculate YTD/Cumulative amount like below mentioned.

 

Nagesh_01_0-1663139063235.png

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below, and please check the below picture and the attached pbix file.

Jihwan_Kim_1-1663140780313.png

 

 

Jihwan_Kim_0-1663140763084.png

 

YTD and previous December: =
IF (
    NOT ISBLANK ( [Amount measure:] ) && HASONEVALUE ( 'Calendar'[Date] ),
    CALCULATE ( [Amount measure:], DATESYTD ( 'Calendar'[Date] ) )
        + CALCULATE (
            [Amount measure:],
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[Year]
                    = MAX ( 'Calendar'[Year] ) - 1
                    && 'Calendar'[Month number] = 12
            )
        )
)

 


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

View solution in original post

Hi,

Thank you for your feedback.

The measure has HASONEVALUE(Calendar[Date]) function as a condition. This condition is not to show the total row (when it has more than one date value) in the table visualization.

If you write a measure without HASONEVALUE, it will show as expected.

 

YTD and previous December: = 
IF (
    NOT ISBLANK ( [Amount measure:] ),
    CALCULATE ( [Amount measure:], DATESYTD ( 'Calendar'[Date] ) )
        + CALCULATE (
            [Amount measure:],
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[Year]
                    = MAX ( 'Calendar'[Year] ) - 1
                    && 'Calendar'[Month number] = 12
            )
        )
)

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

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below, and please check the below picture and the attached pbix file.

Jihwan_Kim_1-1663140780313.png

 

 

Jihwan_Kim_0-1663140763084.png

 

YTD and previous December: =
IF (
    NOT ISBLANK ( [Amount measure:] ) && HASONEVALUE ( 'Calendar'[Date] ),
    CALCULATE ( [Amount measure:], DATESYTD ( 'Calendar'[Date] ) )
        + CALCULATE (
            [Amount measure:],
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[Year]
                    = MAX ( 'Calendar'[Year] ) - 1
                    && 'Calendar'[Month number] = 12
            )
        )
)

 


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

Hi @Jihwan_Kim 
Awesome!! it works pretty well. Thank you so much for your great help.
However, Could you please check this issue? it's working fine when we use Date field, but when we use year and month number /name, then it's showing blank. 
Please find below screenshot. 

Nagesh_01_0-1663143792293.png

 



Hi,

Thank you for your feedback.

The measure has HASONEVALUE(Calendar[Date]) function as a condition. This condition is not to show the total row (when it has more than one date value) in the table visualization.

If you write a measure without HASONEVALUE, it will show as expected.

 

YTD and previous December: = 
IF (
    NOT ISBLANK ( [Amount measure:] ),
    CALCULATE ( [Amount measure:], DATESYTD ( 'Calendar'[Date] ) )
        + CALCULATE (
            [Amount measure:],
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[Year]
                    = MAX ( 'Calendar'[Year] ) - 1
                    && 'Calendar'[Month number] = 12
            )
        )
)

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

@Jihwan_Kim 
It's Perfect. Thank you again.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.