Forum Discussion
tomas12344
1 year agoHelper III
Time intelligence function working for leap year or not
I found many post and articles on web about that time intelligence functions are not woking for leap year calculations. Can someone confrim, that this issue is still present? I had creted a small...
- 1 year ago
Hi tomas12344, the best solution is to test it out 🙂
As you can see from the example below, SAMEPERIODLASTYEAR() considers leap year:
I always suggest to have a tehcnical measures that are showing you what period is actually selected (which might be different from what one expects 😉 )
Here is a code of the measure for this test:
Same Period Last Year = VAR _SamePeriodLastYear = SAMEPERIODLASTYEAR( c_Calendar[Date] ) VAR _MinDate = MINX( _SamePeriodLastYear, [Date] ) VAR _MaxDate = MAXX( _SamePeriodLastYear, [Date] ) VAR _Result = IF( _MaxDate <> _MinDate, "Currently Selected Same Period Last Year: " & _MinDate & " - " & _MaxDate, "Currently Selected Same Period Last Year: " & _MinDate ) RETURN _ResultGood luck with your task!
Sergii24
1 year agoSuper User
Hi tomas12344, the best solution is to test it out 🙂
As you can see from the example below, SAMEPERIODLASTYEAR() considers leap year:
I always suggest to have a tehcnical measures that are showing you what period is actually selected (which might be different from what one expects 😉 )
Here is a code of the measure for this test:
Same Period Last Year =
VAR _SamePeriodLastYear = SAMEPERIODLASTYEAR( c_Calendar[Date] )
VAR _MinDate = MINX( _SamePeriodLastYear, [Date] )
VAR _MaxDate = MAXX( _SamePeriodLastYear, [Date] )
VAR _Result =
IF(
_MaxDate <> _MinDate,
"Currently Selected Same Period Last Year: " & _MinDate & " - " & _MaxDate,
"Currently Selected Same Period Last Year: " & _MinDate
)
RETURN
_Result
Good luck with your task!