Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

SAMEPERIODLASTYEAR() returns incorrect result when current day is selected

Hello, 

I'm strugling with calculation of last year's bookings. I'm using the function SAMEPERIODLASTYEAR, but for some reason when current day or some future date is selected, it returns value of bookings for whole month (picture attached). When I choose yesterday's date, calculation is correct - it takes only same part of last year's month.

 

I was trying to put in the formula additional filter that limits my table 'Date - bookings' to today()-1, but without any good results. 

 

Has anybody experienced same issue?

Thank you for any suggestions.

 

Bookings USD =  SUM(contract_data[price])

 

Prior Period =
CALCULATE([Bookings]                                        
                    ,SAMEPERIODLASTYEAR('Date - bookings'[Date])
                    )
 
The Date table is calculated, relationship is 1:N and one-way:
Date - bookings =
ADDCOLUMNS (
                   CALENDAR (MIN(contract_data[booking_date]), TODAY()),
                   "Year/Month", FORMAT ( [Date], "YYYY/MM" ))
 
pbi.png
5 REPLIES 5
Anonymous
Not applicable

Do you have a dedicated date table? If so, is it marked as such?  

Anonymous
Not applicable

Hi, thanks for your reply. Yes it is marked as date table. It is calculated table as noted in my post above.

Capture.PNG

Anonymous
Not applicable

can you upload some sample data?

Anonymous
Not applicable

Hi, 

the file is here: https://gofile.io/?c=459T1J

Thanks

Anonymous
Not applicable

it's working like it is supposed to. Everything comes down to context. So when you have a date slicer that stops before the current end of the month, it will give you the total of the previous period of that same time. 

Sameperiod explanation.png

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.