Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello Power BI community,
My team and I encountered some strange results using the dateadd and sameperiodlastyear functions to shift the current calendar year dates back one year. We have a typical date table that includes dates from January 2019 up until the current calendar date. To grab the current period Dates I used the following: CurrentDates = DATESYTD('Date'[Date]), which correctly produces the dates in the current calendar year (1/1/2021 - 7/23/2021). What's interesting is that when I try to shift those dates back one year using: CurrentDatesLY = DATEADD(CurrentDates, -1, YEAR), it includes through 7/31/2021:
When I use DATEADD(CurrentDates, -365, DAY) it returns the correct range:
Does anyone have any ideas why this happens? I also used SAMEPERIODLASTYEAR(CurrentDates) and it produced the same issue including to 7/31/2021. If anyone knows what's happening that would be much appreciated, I am currently on version 2.95.804.0.
I think Marco Russo potentially explains it better than I. I think this might be the issue around the function you are using.
https://www.youtube.com/watch?v=JS-K2faCiCc
Proud to be a Super User!
The narrator in the referred clip is Alberto Ferrari😀
As pointed out at 3:10 of the clip, the intervention of the invisible ALL() on date column is the crux of unexpected behaviour of TOTALYTD/DATESYTD. Good to see it unveiled!
Cheers!
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
haha @CNENFRNL freudian error....you would think i would know that seeing as i have watched more videos from them over the years than i have tv! however they pretty synonomous with each other in this world 😉
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
76 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |