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

function SAMEPERIODLASTYEAR() not working

Hi, I'm trying to apply a sameperiolastyear function but is not working, this is my DAX: 


Invoices Same Period Last Year =
 
 CALCULATE(
    SUM('Monthly Sales Evolution Invoices'[Sum of Amount]),
    SAMEPERIODLASTYEAR('Monthly Sales Evolution Invoices'[Date])
 )


is there something wrong?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JEM_Systems ,

 

I suggest you to create a calendar table with continuous date by CALENDAR()/CALENDARAUTO() function.

Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]))

Measure:

LY Sales = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Calendar'[Date]))

Result is as below.

vrzhoumsft_0-1683018994475.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
RMDNA
Solution Sage
Solution Sage

Hi @JEM_Systems - we would need a lot more info than that. How specifically is it not working? What kind of error does it return? Providing screenshots would help

JEM_Systems_0-1682633520894.pngJEM_Systems_1-1682633532518.png

Is not showing any data, could you @RMDNA help me?

Anonymous
Not applicable

Hi @JEM_Systems ,

 

I suggest you to create a calendar table with continuous date by CALENDAR()/CALENDARAUTO() function.

Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]))

Measure:

LY Sales = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Calendar'[Date]))

Result is as below.

vrzhoumsft_0-1683018994475.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors