Forum Discussion
SAMEPERIODLASTYEAR(DATESYTD( )) different from DATESYTD(SAMEPERIODLASTYEAR( ))??
- 7 years ago
This is just another case where the Time Intelligence functions don't work as expected because the Date table is wrong.
Remember: Time Intelligence functions are guaranteed to work *only* if the Date table is "complete" - meaning you need all the dates until the end of the year.
Not doing that, what happens is that the year 2019 seems made by 15 days, so if you include all of them than it seems you have an entire month, or an entire year.... You are violating the assumption made by Time Intelligence and you cannot trust any result at that point.
Hi v-lili6-msft
Thanks very much. I look forward to hearing from them.
Perhaps very knowledgeable people like Zubair_Muhammad, Greg_Deckler, MFelix would care to chip in?
Many thanks
- Zubair_Muhammad7 years ago
Community Champion
Very interesting
I remember you found a bug before as well :smileywink:
I am not sure why this is happeningbut if we use following we get correct results even with the last date.
YTDPreviousYearRevenue = CALCULATE ( SUM ( Revenue[Revenue] ), SAMEPERIODLASTYEAR ( DATESYTD ( 'Date Table'[Date].[Date]) ) )- AlB7 years ago
Community Champion
Thanks very much Zubair_Muhammad
It gets more and more intriguing. Let's see what the others say.
- MFelix7 years ago
Super User
Hi @AIB,
Forgot to mention not on the computer right now but will try and have a look at your PBIX file later.
Regards,
MFelix
- MFelix7 years ago
Super User
Hi @AIB,
Check the blog post below were it shows different options mayve is a good starting point to get the best option.
http://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question
Regards,
MFelix