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.
- v-lili6-msft7 years ago
Community Support
hi, AlB
Unfortunately, So far I haven't got any reply about this question.
and I read these in the book The Definitive Guide to DAX: Business intelligence with Microsoft Excel, SQL Server Analysis Services, and Power BI by Marco Russo and Alberto Ferrari.
in page 173:
The following two definitions of PY YTD Sales are equivalent, even if the second one could be slightly faster (but barely measureable).
and in your case, date table is from "2018,1,1" to today, you may try this formula
Date Table = ADDCOLUMNS ( CALENDAR (DATE(2018,1,1), DATE(YEAR(TODAY()),12,31)), "Year", YEAR ( [Date]), "Month Name", FORMAT ( [Date], "mmmm" ), "Monthnumber", FORMAT ( [Date], "MM" ) )add a judge column for date table
judge = IF('Date Table'[Date]<=TODAY(),1,2)Then add it to report level filter and set it "1"
Result:
This is just as a reference, I also think reason for this case is that date table is incomplete.
Best Regards,
Lin
- AlB7 years ago
Community Champion
Thanks marcorusso and v-lili6-msft
- AlB7 years ago
Community Champion
MFelix, Greg_Deckler, any ideas?
Thanks very much
- Greg_Deckler7 years ago
Community Champion
I would think that marcorusso might like to dig into this one. All I can say is this is the kind of reason that I creaed the Time Intelligence The Hard Way Quick Measure:
The time intelligence functions are just these mysterious little black boxes that just act downright weird at times. I frankly don't really trust them as far as I can try catch throw them.
- marcorusso7 years ago
Most Valuable Professional
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.