Forum Discussion
Anonymous
5 years agoNot applicable
Unexpected behavior Sameperiodlastyear
Hi, I'm using the function sameperiodlastyear in some measures and they work fine for all periods besides the current month. I would expect to see the MTD value of lastyear's data there but it sh...
- 5 years ago
Anonymous
Did you make it look like this? dateadd('Date'[Date],-365,day)
-1 is yesterday , -365 goes back to 12 months.
aj1973
Community Champion
5 years agoAnonymous
The difference is in the granularity of data you want to see in your visual. PREVIOUSYEAR returns the result of the entire previous year, DATEADD returns back the number of days from the date you want to start your calculation. Nothing wrong with either approach, it is just how the user wants to see the data in a specific visual.
Check out this article may it could help.
https://minova.nl/geen-categorie/power-bi-dax-dateadd-versus-previousmonth
https://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question
Anonymous
5 years agoNot applicable
Ok clear, thank you!