Forum Discussion
TotalYTD is returning Monthly total
Hello,
The formula you are using is missing one of the optional arguments, the filter: formula I am trying to use to get YTD looks Like: TotalYTD = Calculate ([MontlyTotal],DatesYTD(DateTable[Date],"9/30"))
Here is the sample from Microsoft's online documentation:
=TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[DateKey], ALL(‘DateTime’), “6/30”)
The ALL function removes any filters that may have been placed on the calendar by other visuals on the report
The filter argument and the year end argument are optional, but if you want to use the year end argument you need to also have the filter argument....otherwise dax will try to interpret your year end valueas a filter.
I'm a personal Power BI trainer I learn something new every time I answer a question.
I should have been clearer.
If you placed your measure in table, when it ran the filter context in which it would be running would be the month of that row....so its "total" would be the same as the total for the month, as there would be no other months in the filter context for it to add up
When you add the ALL() as the filter, The all removes the filters from your calendar table, so all the months are available, and then the function can add up all the months in the ytd.
All DAX measure run INSIDE AN OUTER FILTER CONTEXT.... this context is not "visible" if the forumla for the measure, but it has a profound effect on the results it returns.