Forum Discussion
Timeline Slicer + YTD Measure
Hello, everybody!
I am using the Timeline Slicer in the months and I am having a problem in the current year (2020).
I have filtered the display to only show me the months that have values, that's why it shows me from January to April.
The problem is that when I select from January to April, it compares the whole year of the YTD which is incorrect. I should only consider myself until April:
How could I solve this problem in DAX?
Basically I don't want to be added to the accumulated value of the months of the current year that have not yet passed.
Thank you!
Regards!
Anonymous ,
Please refer to this file, if this can help. Check the calculation of LYTD, LYD2 vs others
9 Replies
- Greg_Deckler
Community Champion
What is the calculation you are using? Are you using SAMEPERIODLASTYEAR?
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008- AnonymousNot applicable
Hi
I am using the SAMEPERIODYEAR, but I think the problem is the Time Slicer that even if I select from January to April it takes me the whole year.
If I select from January to March the values in the table are correct:
But when I select from January to April it takes me the whole year and that's the problem I have.
Thanks
- amitchandak
Super User
Anonymous ,
Not tested. try like
Last YTD Sales = = var _max =date(year(today())-1,month(today()),day(today())) return CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]),'Date'[Date]<=_max)
- amitchandak
Super User
Anonymous , try like
YTD Sales = var _max =today() return CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"),'Date'[Date]<=_max) Last YTD Sales = = var _max =date(year(today())-1,month(today()),day(today())) return CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"),'Date'[Date]<=_max)