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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

TOTALYTD is not working

I have used the following Dax code for calculating the YTD amount fiscal year starting from April 1.

 

Sales FYTD = 
CALCULATE (
    [Total FactPriSales],
    DATESYTD (
        DimDate[Date],
        "3/31"
    )
)

 

But this gives me blank result. This is the model view

 

ytd.PNG 

I have attached sample pbix file. 

Thank you

sample.pbix 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,Please find the attached file after the signature. I can see YTD reset after march. Marked Date table as Date table 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous ,

For Without slicer.

Please note that when you do NOT use the date slicer of a date filter, then the last date of the calendar will be taken as the date to end YTD.

 

Now you can stop your calendar today. As this was no created in power BI, You might not able to do that.

 

You have use filter/slicer in this case.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@Anonymous ,Please find the attached file after the signature. I can see YTD reset after march. Marked Date table as Date table 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@Anonymous , This does not seem lik FY starting from April. The one you shared is for FY starting July. Try like

 

Sales FYTD = 
CALCULATE (
    [Total FactPriSales],
    DATESYTD (
        DimDate[Date],
        "03/31"
    )
)

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Dear @amitchandak 

You are correct it was a mistake. But still, the code is not working

Hi, @Anonymous , DATESYTD() evaluates in current context instead of current date. You might want to use this measure to verify its actual range in current context.

 

test DatesYTD = 
VAR __dates = DATESYTD ( DimDate[Date], "6/30" )
RETURN
    MINX ( __dates, DimDate[Date] ) & UNICHAR ( 10 )
        & MAXX ( __dates, DimDate[Date] )

 

Screenshot 2020-12-24 012701.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.