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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
YoShan65
New Member

DATESYTD not working

Hi everyone.

I've been learning BI the last past weeks and I face a problem I don't understand. I have tried a lot to solve it and understand but it starts to discourage me, even more since this kind of function seems to be a classical thing on BI.

 

I can't get TOTALYTD, or DATESYTD, and all inner time intelligence filters function to work as I understand they work. 

Maybe i just don't understand the row filter context, but i explored the thing to be sure, I detailed the rows and the computing steps, and I stil don't get why it does not work. 

 

Here is first time I had this issue, on Microsoft Learn : Utiliser des fonctions Time Intelligence DAX - Training | Microsoft Learn

When I download the adventre works M07 and try the TOTALYTD function as writen in the microsoft learn page, I get this

YoShan65_0-1737908657456.png

The revenue YTD column does not sum all the revenues on the "same fiscal year" as shoud suggest the TOTALYTD function. Indeed, in the microsoft learn page, the following culumns appear :

 
 

YoShan65_3-1737908811274.png

After that, I checked a lot of things to understand what was wrong in my calculation. I check in using a CALCULATE function with a datesytd filter, I ensure that the date table was idenitifed as a date table, I wrote a function to create a colum which enumerates the min and max date of the calculate filter function, and so on. But still, it does not sum on the year and I don't understand why even in the microsoft learn example I can't get to understand why ...

 

I'm sorry if the text is not well writen, i'm french and it's the first time I use a forum. 

 

Best, and thanks for any contributor !

1 ACCEPTED SOLUTION

Hi @Greg_Deckler ,

And first, thank you for your answer. I'm sorry I took some time to answer, since I took a lot of time to understand well all the info in the links you shared.

I tried to code some of the functions the hard way, and it seems to get me some results ! But since I am a beginner, I still do not understand all I am coding with those hard way function ^^

So I keep trying your solution, I keep on trying to understand all of this, and when I get a clear list of questions, i come back to this discussion.

View solution in original post

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @YoShan65 ,

 

Did Greg_Deckler's reply help you? If so, please accept it as solution.

BTW, DATESYTD is a DAX function in Power BI Desktop used to calculate year-to-date values. It's particularly useful for time series analysis, especially for calculating cumulative values from the beginning of the year to a specified date.

vstephenmsft_0-1738133148994.png

YTD Sales = CALCULATE(
    SUM('Table'[Sale]),
    DATESYTD('Table'[Date])
)

Explanation
SUM('Table'[Sale]): Calculates the total sales amount.
DATESYTD('Table'[Date]): Generates a date range from the beginning of the year to the current date.

 

Best Regards,
Stephen Tao

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

Hi @v-stephen-msft ,

And thank you a lot for your answer.
I do understand all of these function, just it seems it does not work with me. Could you please give me the pbix file you used to send your screen shot? Once again, if I do exactly the same as you do, my YTD Sales column displays the exact same values as my Sum of Sales column, that is what I do not understand. 

 

YoShan65_1-1738151133934.png

YoShan65_2-1738151517368.png

 

 


I would like to get your file so I could check if there is something in my writing (and then your file will work) or if there is some thing in my settings, somewhere ...

Greg_Deckler
Super User
Super User

@YoShan65 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,

And first, thank you for your answer. I'm sorry I took some time to answer, since I took a lot of time to understand well all the info in the links you shared.

I tried to code some of the functions the hard way, and it seems to get me some results ! But since I am a beginner, I still do not understand all I am coding with those hard way function ^^

So I keep trying your solution, I keep on trying to understand all of this, and when I get a clear list of questions, i come back to this discussion.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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