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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PowerBeeTree
Helper I
Helper I

calculated column of same date last year using SAMEPERIODLASTYEAR or PREVIOUSYEAR or DATEADD

I have the following date table and i want to create a calculated column using either the SAMEPERIODLASTYEAR or PREVIOUSYEAR or DATEDIFF and not the easy escape of recreating it via DATE() as i want leap years to be taken care of and also to understand better how DAX works.

 

Here is an example date table TBL:

 

date

03/01/2024
03/02/2024
03/03/2024
03/04/2024
03/05/2024
03/06/2024
03/07/2024
03/08/2024
03/09/2024
03/10/2024
03/11/2024
03/12/2024
03/13/2024
03/14/2024

 

for ease let's call the calculated column "LAST_YEAR"

 

Tried all of the following with the respective issued i got stuck at:

  • SAMEPERIODLASTYEAR: the "LAST_YEAR" column is empty when i check the table in the table view
  • PREVIOUSYEAR: returns a table and not sure how to parse the value (which i can see in DAX studio)
  • DATEADD: i use the following but again the column is empty as it seems that the returned value is a table and not a single value.

 

 

DATEADD(TBL[date], -1, YEAR) 

 

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@PowerBeeTree Take a look at the video below. The PBIX file is available from the associated GitHub repository. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

 

This should allow you to understand how those functions are *supposed* to work.

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
PowerBeeTree
Helper I
Helper I

helpful resources to understand how these functions work and understand if these tasks can be completed. Looks like the name of the functions is confusing and won't allow by design to achieve the task at request.

Greg_Deckler
Community Champion
Community Champion

@PowerBeeTree Take a look at the video below. The PBIX file is available from the associated GitHub repository. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

 

This should allow you to understand how those functions are *supposed* to work.

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors