Forum Discussion

tomas12344's avatar
tomas12344
Helper III
1 year ago
Solved

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...
  • Sergii24's avatar
    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
        _Result

     

     

     

    Good luck with your task!