Forum Discussion
ignasivb
3 years agoRegular Visitor
YTD calculation not working properly
Hi all,
I am trying to make a very simple exercise with a verys imple model using the TOTALYTD DAX formula but there is something not working properly for me.
I have created the following measure:
YTDSales = TOTALYTD(SUM(OrderDetail[Sales]), OrderHeader[OrderDate])
When I use it in a simple table, adding OrderDate as a field and not as a hierarchy, plus my new KPI, it works fine (please see screenshot 1 below). However, when I use OrderDate as a hierarchy, it simply doesn't (see screenshot 2).
Same applies to other visualizations. If I create a line chart with the OrderDate as a field (thus having all the values day by day) the calculation works fine, but if I try to group it by, say, months, again the YTD logic is not working whatsoever.
Any ideas on what am I doing wrong? I would like to understand where is my mistake and also how can I fix.
Here is the pbix file in case it helps.
Thank you very much.
Screenshot 1Screenshot 2
That was very helpful! So apparently all that I was missing to make my thing work is to add ".[Date]" to my formula. Tried it and worked like a charm. Thanks!