- 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

SAMEPERIOD LAST Year behaving different by month and week
hi expert,
I may need your expertise as I have encounter an odd scenario.
I am using SAMEPERIODLASTYEAR and by comparing month by month it is behaving perfectly (image below).
The issue happens when I put the week, where the number does not make sense.
Calendar is formatted as a Date table.
Dax I am using is this one:
Any help would be greatly appreciated.
Many thanks in advance
Image 1
image 2
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@zanottiluca
Try this meaure, however, weeks are different from year to year sometimes:
Visits LY =
VAR __PreYear = SELECTEDVALUE('Calendar'[Year]) - 1
VAR __PreWeekNum = SELECTEDVALUE('Calendar'[Week Number])
VAR __Result =
CALCULATE(
[# of Cases],
'Calendar'[Year] = __PreYear,
'Calendar'[Week Number] = __PreWeekNum
)
RETURN
__Result
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

thanks @Fowmy this has solved the issue and also (for future reader) I have been able to put in a drill through line chart (upper level Month and lower level weeknumber) either measure by leveraging the below:
basically the %difference 2 use the above formula while the second uses the SAMEPERIODLASTYEAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@zanottiluca
Try this meaure, however, weeks are different from year to year sometimes:
Visits LY =
VAR __PreYear = SELECTEDVALUE('Calendar'[Year]) - 1
VAR __PreWeekNum = SELECTEDVALUE('Calendar'[Week Number])
VAR __Result =
CALCULATE(
[# of Cases],
'Calendar'[Year] = __PreYear,
'Calendar'[Week Number] = __PreWeekNum
)
RETURN
__Result
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

thanks @Fowmy this has solved the issue and also (for future reader) I have been able to put in a drill through line chart (upper level Month and lower level weeknumber) either measure by leveraging the below:
basically the %difference 2 use the above formula while the second uses the SAMEPERIODLASTYEAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @zanottiluca
DAX Time Intelligence functions are meant to work with YEAR, QUARTER, MONTH, and DAY. WEEK isn't handled.
The reason for this is Week 1 of 2023 doesn't necessarily correspond with Week 1 of 2022.
For example, (with weeks starting on Sunday) 2024/01/01 is a Sunday so it would be Week 1. On the other hand, 2023/01/01 is a Saturday and Week 1 so 2023/01/02 is a Sunday and a new week (Week 2).
These inconsistencies exist for every year because 7 * 12 = 364, not 365. Also, not all years start on a Sunday. Some years are more obvious than others.
Whenever I am working with weeks, I use a date table I have that was written in 'M' - Power Query (I didn't write it but I have used it regularly. ) It includes the following week-related columns:
Week of Year
Week of Month
Start of Week
End of Week
Yr-Week
Yr-Week number
Week Offset
This date table makes handling weeks easier but does not handle the inconsistencies noted above.
I hope this makes sense.
Proud to be a Super User!
daxformatter.com makes life EASIER!

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 | |
---|---|---|---|
09-12-2024 08:26 AM | |||
07-20-2023 06:39 AM | |||
08-16-2024 02:52 AM | |||
10-08-2024 11:21 AM | |||
08-01-2024 08:00 PM |
User | Count |
---|---|
84 | |
78 | |
52 | |
38 | |
35 |
User | Count |
---|---|
95 | |
72 | |
55 | |
52 | |
46 |