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
M001
Helper I
Helper I

SAMEPERIODLASTYEAR and DATEADD return BLANK value from last year

Hi All,

 

I'm stuck and need help. I have a simple table with just Date and Units as shown below. I need to create a column to return value from the same month in previous year in Power Pivot Data Model. Unfortunately, I have tried the following DAX formula but all return as Blank value,

 

 

 

=CALCULATE(SUM([Units]), SAMEPERIODLASTYEAR(Table1[Date]))
=CALCULATE(SUM([Units]), DATEADD(Table1[Date], -1, YEAR))

 

 

 

ReturnBlankValue_LastYear.PNG

 

Alternatively, I have tried using PREVIOUSYEAR. There are numbers showing but it's incorrect and I cant figure it out why either

 

=CALCULATE(SUM([Units]), PREVIOUSYEAR(Table1[Date]))

 

 

ReturnBlankValue_LastYear_with_IncorrectData.PNG

 

Hope someone could enlighten me, thank you!!

1 ACCEPTED SOLUTION
jmlesteves
Frequent Visitor

Hi

Sorry for the first answer, I misunderstood your question and now I noticed you want a Calculated Column, instead of a Measure.
Try this:
CALCULATE (
    SUM ( Table1[Units] );
    ALL ( Table1 );
    SAMEPERIODLASTYEAR ( Table1[Date] )
)

View solution in original post

2 REPLIES 2
jmlesteves
Frequent Visitor

Hi

Sorry for the first answer, I misunderstood your question and now I noticed you want a Calculated Column, instead of a Measure.
Try this:
CALCULATE (
    SUM ( Table1[Units] );
    ALL ( Table1 );
    SAMEPERIODLASTYEAR ( Table1[Date] )
)

Thank you, I just realize it's a filter seting issue, not exactly the same as your solution but your help has definitely enlightened me and I appreciate a lot

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.