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
BIUser1998
Helper I
Helper I

TOTALYTD not working with year filter

I have a data table and I'm performing YTD Calculation using the TOTALYTD Function. My year starts in June and ends in May.

 

I have written the following dax code which is working fine when I pass the year as 2024 but its giving me a blank value when I set the year to 2023. Can someone please guide me as to why this might be happening? Thank you for the help!

 

DAX Code

Total = TOTALYTD(SUM('Table'[Value]), 'Table'[Date], FILTER('Table','Table'[Year] = 2024, "05/31")     

 

Data table

DateValueYear
June 20222462023
June 20231602024
July 20221802023
August 2022792023
September 20222132023
October 20222372023
November 20221562023
December 20222062023
January 2023822023
February 20231882023
March 2023762023
April 2023842023
May 20232002023
July 20232592024
August 20231852024
September 20232002024
October 20232742024
November 2023442024
December 20232532024
January 2024 2024
February 2024 2024
March 2024 2024
April 2024 2024
May 2024 2024
5 REPLIES 5
lbendlin
Super User
Super User

Time Intelligence functions like TOTALYTD must be used against the Calendar table in your data model, not the fact table.  The calendar table must be contiguous (no gaps) and covering both the source and the destination of your time intelligence calculation.

Anonymous
Not applicable

Hi @BIUser1998 ,

To your question, here is my answer.

I put your data into Desktop and ran your DAX code and found that it didn't work, but it worked when I changed the code to the following form.

Total = TOTALYTD(SUM('Table'[Value]), 'Table'[Date], FILTER('Table','Table'[Year]))  

vyilongmsft_0-1707185766659.png

If you change the year to 2023 it will also work.

Total = TOTALYTD(SUM('Table'[Value]), 'Table'[Date], FILTER('Table','Table'[Year] = 2023))  

vyilongmsft_1-1707185877181.png

 

 

Best Regards

Yilong Zhou

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

Hi @Anonymous but if you put the measure into a KPI widget, it shows <blank> instead of showing the total

lbendlin
Super User
Super User

You MUST use TOTALYTD against your CALENDAR table, not your fact table.

Hello @lbendlin Can you please elaborate more on this please?

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.