- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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 example, where the calendar table contains many day, including 28.5.2025 and 29.2.2024. Same for fact table.
Then I run something like this, but only for 28.2.2025
this returned the date 28.2.2024, so the exact date as selected was moved backwards 1 year.
But when I used the Sameperiodlastyear function in measure calculation, it returned correct values, like
Calculate(sum(), sameperiodlastyear('date'[date])
(this measure used for MTD and aslo YTD calculation for previous year, that means selecte in calendar table 28.2.2025, and needed to move back to 29.2.2024)
Model is just simple, calendar table and fact table, and between calendar and fast is relation on date column. Fact table contains only monthly snapshots, calendar contains all days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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!

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
03-21-2024 12:49 PM | |||
Anonymous
| 11-30-2023 02:59 PM | ||
09-05-2024 05:59 AM | |||
07-25-2022 07:29 AM | |||
10-14-2023 06:57 AM |