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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need help with SAMEPERIODLASTYEAR, figures not showing

Hi, I am new to PowerBI and I've been trying to calculate the sales amount using SAMEPERIODLASTYEAR but it's not working. I have the monthly sales data from Jan 2020 to March 2021 and I also created a date table called 'Calendar' (marked this as date table as well). This is the formula I used to calculate the sales amount:

  • Sales Last Year = CALCULATE([Sales Amount],SAMEPERIODLASTYEAR('Calendar'[Date]))

However, when I checked the results using matrix, I did not obtain any figures in the Sales Last Year Column for Jan 2021 to March 2021. Instead, I obtained figures for Jan 2020 to July 2020, which is obviously wrong. 

 

Can someone help me with this? Thank you!

 

gandalf00_0-1627366866403.png

 

 

 

 
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Are you using calendar[Date] for the date column in your table visual? If not, you should.

 

*EDIT* Also, silly question, but have you related your calendar table to your fact table?

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Are you using calendar[Date] for the date column in your table visual? If not, you should.

 

*EDIT* Also, silly question, but have you related your calendar table to your fact table?

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

It works now! Thank you 🙂 

@Anonymous ,

 

Cool, glad it's working for you now.

Please mark my answer as the solution to ensure that other people facing the same issue can find the answer quickly.

 

Ta,

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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