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! Learn more

Reply
GJeanes1
Frequent Visitor

YTD percentage with multiple years of data

So I have multiple years of data, and I cannot seem to get the correct YTD percentage total.

here is my measurement:

YTD Percentage Change =IF(ISFILTERED('Sheet1'[Date and Time]),ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),VAR __PREV_YEAR =CALCULATE(COUNTA('Sheet1'[Incident]),DATEADD('Sheet1'[Date and Time].[Date], -1, YEAR))RETURNDIVIDE(COUNTA('Sheet1'[Incident]) - __PREV_YEAR, __PREV_YEAR))

However, When I use my slicer to separate the "incident" value the YTD displays as

2023, 30, -48.61%

2022, 47, 24.14%...

But as you see using a YTD calculator

(30-47) / |47| * 100 = 36.17%

 

I am also using a filter for dates and manually updating or checking which dates to display.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GJeanes1 ,

Please try:

YTD Percentage Change =
IF (
    ISFILTERED ( 'Sheet1'[Date and Time] ),
    ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
    VAR __PREV_YEAR =
        CALCULATE (
            COUNTA ( 'Sheet1'[Incident] ),
            DATEADD ( 'Sheet1'[Date and Time].[Date], -1, YEAR )
        )
    VAR __SELECTED_DATE =
        DATESYTD ( MAX ( 'Sheet1'[Date and Time].[Date] ), "Calendar Year" )
    RETURN
        DIVIDE (
            CALCULATE ( COUNTA ( 'Sheet1'[Incident] ), __SELECTED_DATE ) - __PREV_YEAR,
            __PREV_YEAR
        )
)

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @GJeanes1 ,

Please try:

YTD Percentage Change =
IF (
    ISFILTERED ( 'Sheet1'[Date and Time] ),
    ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
    VAR __PREV_YEAR =
        CALCULATE (
            COUNTA ( 'Sheet1'[Incident] ),
            DATEADD ( 'Sheet1'[Date and Time].[Date], -1, YEAR )
        )
    VAR __SELECTED_DATE =
        DATESYTD ( MAX ( 'Sheet1'[Date and Time].[Date] ), "Calendar Year" )
    RETURN
        DIVIDE (
            CALCULATE ( COUNTA ( 'Sheet1'[Incident] ), __SELECTED_DATE ) - __PREV_YEAR,
            __PREV_YEAR
        )
)

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Greg_Deckler
Community Champion
Community Champion

@GJeanes1 See if this video helps, it presents a bunch of different options for calculations like this:



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.