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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

SAMEPERIODLASTYEAR issue

Hi,

 

Having an issue whereby using SAMEPERIODLASTYEAR it's not recognising a date column, even though it's definitely formatted that way.

 

DAX...

 

PGT Previous = if([PGT Int Pop] = BLANK(), BLANK(), [PGT Int Pop] - CALCULATE([PGT Int Pop], SAMEPERIODLASTYEAR('Academic Year Conversion'[Academic Year].[Year])))

 

Coming back with the following error...

 

CommDELETE.png

 

Then looking at the Academic Year Conversion column, this is definitely formatted as DATE..

 

CommDELETE1.png

 

...same in QueryEditor...

 

CommDELETE2.png

 

Any idea where I'm going wrong?

2 REPLIES 2
Anonymous
Not applicable

Using the auto-generated date/time hierarchies is one of the worst things you can do in Power BI. Please never do this. Stick to a calendar that you either import or create in Power Query. You'll then always be safe and will reduce the model size as well.

amitchandak
Super User
Super User

@Anonymous , remove .year. But better use a date table

PGT Previous = if([PGT Int Pop] = BLANK(), BLANK(), [PGT Int Pop] - CALCULATE([PGT Int Pop], SAMEPERIODLASTYEAR('Academic Year Conversion'[Academic Year])))

 

PGT Previous = if([PGT Int Pop] = BLANK(), BLANK(), [PGT Int Pop] - CALCULATE([PGT Int Pop], SAMEPERIODLASTYEAR('Date'[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.