Forum Discussion
Previous Year YTD
- 5 years ago
Hi Anonymous ,
Try to change the ""12/31" to "10/31" in your scenario, which defines the year-end date.
Reference: DATESYTD function (DAX) - DAX | Microsoft Docs
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous ,
Have you tried Time intelligence
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Or
YTD=
var _min = date(year(today()),1,1)
var _day = datediff(_min, today(),day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] =year(Today()) && 'Date'[Day of Year] <= _day) )
LYTD =
var _min = date(year(today())-1,1,1)
var _max = date(year(today())-1,month(today()),day(today()))
var _day = datediff(_min, _max,day)+1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year] = year(Today())-1 && 'Date'[Day of Year] <= _day))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Thanks amitchandak ,
I tried with above dax but not getting correct solution
See values using 1st DAX . I think its calculating sum from nov-2019 till feb 2020. I need till october2020
- Icey5 years agoCommunity Support
Hi Anonymous ,
Try to change the ""12/31" to "10/31" in your scenario, which defines the year-end date.
Reference: DATESYTD function (DAX) - DAX | Microsoft Docs
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.