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 August 31st. Request your voucher.

Reply
Kray
Helper I
Helper I

SAMEPERIODLASTYEAR Function Lack

Hello, 

 

I use this function very well but there is a lack , if the product was not sold on current month-week-year yet you cant see the last year sales. how can I see the last year data within this condition? 

1 ACCEPTED SOLUTION

@Kray

Change the SamePeriodLastYear measure to the following, you will get value in Feb.

SamePeriodLastYear = CALCULATE([sale],SAMEPERIODLASTYEAR(TAKVIM[Date]))
1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

7 REPLIES 7
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@Kray.

Could you please share sample data of your table and post expected result here? In my scenario, SAMEPERIODLASTYEAR function works well.

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sure, I choosed X category , my first pic is 2017 and second one is 2016 .  At the first pic , last february has to show 835.944 but it doesnt because in 2017 there is no any sales in the X category.

 

image.png

image.png

 

 

 

 

 

 

 

@Kray,


When you use Year, MonthName fields and the measure to create visual, do you get data in February? And could you please paste the data of your tables in Excel file and share us the Excel file via OneDrive?

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Check my now and last numbers on pic you will see same number(Second order in 2017 and first order in 2016)

I think the lack is this function's operating logic . It compares current data with last data , if current data is absent function cant compare so it shows zero . You can try it with your data 

@Kray

Change the SamePeriodLastYear measure to the following, you will get value in Feb.

SamePeriodLastYear = CALCULATE([sale],SAMEPERIODLASTYEAR(TAKVIM[Date]))
1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

So great, it works now 🙂 Thank you Dear Lydia. 

@Kray,

I am not sure what fields you use to create the visual, could you please describe the fields in the visual.  And we also need to know that  if you get data in February when you use Year, MonthName fields and the measure to create visual.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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