Forum Discussion
Sal1037
Advocate II
6 years agoSameperiodlastyear - Leap Year
-I have a report with 3 columns (Date, System Sales, System Sales LY) -The goal is to compare Day to Day Sales from this year to Last year. -I have used the basic DAX for the Sales calculation ...
- Anonymous6 years agoThis is the correct behaviour. This is how it should be. The last day of the month is compared to the last day of the month of the prior year. This is what time-intel means. If you want to override this, you'll need to write your own piece of logic that'll deal with Feb 29. Rather easy to do.
AlexAlberga727
Resolver II
6 years agoIm curious if you would instead use the DATEADD opposed to SPLY if it would be any different. I have had issues with SPLY in the past and since have used DATEADD instead.
Lets try this first - as SPLY may have logic built in for leap year.. which i suppose folks off of leap year would like to know what they made last year if there was a leap year for the 28th... anywho this is a silly oversight imo by microsoft possibly.
Double check your data to ensure there are no values for 02/29/2019 - I understand this date technically doesnt exist..
Anywho -
Rev. LY =
CALCULATE( [TOTAL REV], DATEADD( dDATES, -1 , YEAR) )
let me know if there are any differences.
Sal1037
Advocate II
6 years agoHi Alex, Thanks for the quick response.
-I have tried the DATEADD. It gave me the same outcome as the 'Sameperiodlastyear'
-I called it 'SystemSales LY_2'. The DAX formula is: System Sales LY_2 = CALCULATE([System Sales],DATEADD(DateDimension[Date],-1,YEAR))
Please see the attached screenshot for reference.
-Just to be sure, I have checked both 'Sales table' and 'Date dimension table. Neither tables have the date '2/29/2019' as it does not exist. Thus there is no data associated for that date '2/29/2019'. However, I believe due to the leap year of 2/29/2020, PBI is auto-populating value for it.
- Anonymous6 years agoNot applicableThis is the correct behaviour. This is how it should be. The last day of the month is compared to the last day of the month of the prior year. This is what time-intel means. If you want to override this, you'll need to write your own piece of logic that'll deal with Feb 29. Rather easy to do.
- Anonymous6 years agoNot applicableBy the way... You should never rely on the automatic Date table that PBI creates for you. NEVER. You should always create your own Date table according to the rules for such tables.