Forum Discussion
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:
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!
9 Replies
- Padycosmos
Solution Sage
- ignasivbRegular Visitor
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!
- sudhav
Helper V
I think you have to use ALL function. just try it, i am not sure.
YTDSales = TOTALYTD(SUM(OrderDetail[Sales]), ALL(OrderHeader[OrderDate]))
If I answered your question, accept it as solution and give kudos!
- Ahmedx
Super User
Is this what you are looking for?
https://dropmefiles.com/4jfWh - Ashish_Mathur
Super User
Hi,
Create a Calendar Table with a relationship (Many to One and Single) from the OrderDate column to the Date column of the Calendar Table. In the Calendar Table, write calculated column formulas to extrat Year, Month name and Month number. Sort the Month name by the Month number. To every visual/filter, drag any date related field only from the Calendar Table. Write these measures:
Measure = SUM(OrderDetail[Sales])
YTD measure = calculate([measure],datesytd(Calendar[Date]),"31/12")
Hope this helps.
- ignasivbRegular Visitor
Thank you all for your messages. Does this mean I cannot use the TOTALYTD function unless I visualize the information at a date level (i.e. I cannot use it in a table grouping sales by month)?
- Ahmedx
Super User
it is possible like this: