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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
koorosh
Post Partisan
Post Partisan

Same Period Last Year

Hi, Why sameperiodlastyear did not result in one year back from the date column selected?

 

 

9 REPLIES 9
VilmarSch
Post Partisan
Post Partisan

Apparently it's normal:

 

The SAMEPERIODLASTYEAR is equivalent to DATEADD(dates, -1, year).
Its biggest year in the date table is 2019, so SAMEPERIODLASTYEAR will show the previous year, i.e. 2018.
Its smallest year in the date table is 2014, so SAMEPERIODLASTYEAR will not show the previous year, i.e. 2013.

 

Sem título.png

Why it is normal that does not show 2013? If you use DATEADD(dates, 1, year), and the biggest one is 2016 (attached file) the result shows 2017.

koorosh
Post Partisan
Post Partisan

 
Ahmedx
Super User
Super User

SELECTCOLUMNS('Table',"Date",SAMEPERIODLASTYEAR('Table'[Date]))
will give empty at the beginning , go down and you see dates

Thanks. Why there are no empty rows or 2013 rows in the sameperiodlastyear table?
And why there is no 2013 rows in selectcolumn table and it shows empty rows ? 

Ahmedx
Super User
Super User

it works, it moves the date back one year.
you will lose the last year, and you will not see the first year, since it is not in the table.
if your date is early 2014 and late 2023
you will see only 2014 and 2022, and do not see 2013 because it is not in the table

Do you mean 2013 will not be in the output? why?

Ahmedx
Super User
Super User

you need other features

Screen Capture #1284.png

Thanks.But my question is , in the defination of this function was written "Returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context."
Why I can not get this result?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.