Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Not understanding TOTALYTD

Hello, I am wondering whether I have misunderstood the TOTALYTD function.   I thought it only calculated values in an expression that are in the range from 01.01. of this year to today's date. I ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    You can add the Date column into the same table visual as the TotalYTD measure. Observe the result of each date, I'm sure this will help you understand how TOTALYTD function works better.

     

    The "date" of "year-to-date" is not today, it refers to a specified date in the context where the measure is evaluated. In the following data, there are two years data in the table. On each row, the specified date is the date on that row and the measure calculates the TYD result based on that date. 

    In your original table visual which only has the measure, the specified date will be the maximum date available in the data table, so it calculates YTD based on the date 02.07.24 and returns the result 90. 

     

    You may need to learn about the concept of Context. It is very important in DAX. The context of a measure may change so it will return different results when evaluated in different visuals or along with different fields. 

    Understanding context transition in DAX - SQLBI

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!