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.
Bankyiie
2 years agoNew Member
A possible option for this is to create a calculated column in your date table to flaf Feb 29 as a Leap Day. Then use the code below for setting last year numbers to 0 for Feb 29 .
VAR LeapDay = IF( HASONEVALUE( 'Date'[Date] ), MAXA( 'Date'[LeapDay] ) )
RETURN
SWITCH(
TRUE( ),
LeapDay = 1, 0,
CALCULATE( Sales , SAMEPERIODLASTYEAR( 'Date'[Date] ))
)