Forum Discussion
Please explain YTD calculation in this simple example
- 2 years ago
Ok forget about this one I found out how to ammend.
Apparently with this function it does not take into account filter context so you need to make it yourself 🤨YTD = CALCULATE(SUM(Sheet1[Qty]),FILTERS(Sheet1[Type]),DATESYTD(dimDate[Date]))Did the trick - 2 years ago
Okay after lots of trial and error I found out how to do it also without datesytd function.
Really don't understand why every case is again lots of trial and error for me 🤣
Then I need to use ALL, other time I need to use REMOVEFILTER other time it is something else again.
But Ok I now found the way with datesytd (YTD) and one wihtout (YTD2):
The dax for the datesytd I already shared. And YTD2 I was able to find by :
YTD2 = CALCULATE(SUM(Sheet1[Qty]),Sheet1[Date] <= MAX(Sheet1[Date]),FILTERS(Sheet1[Type]))So yes amitchandak thanks for putting me on my way with datesytd.I guess by playing around with that one I also found the other way 😉
amitchandak I tried also in the simple example with datesytd function but thats does not take the type into account :
It should count A 5 + 12 = 17 not 39.
It just counts every Qty without taking in account any other fields.
Ok forget about this one I found out how to ammend.
Apparently with this function it does not take into account filter context so you need to make it yourself 🤨