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
joshuavd
Frequent Visitor

same period last year not working

I have been trying to create a SamePeriodLastYear() query but I am getting the same amount for the time period and wondering if someone could help me figure out what is wrong.  The pictures of the data model and my results are below:

 

Total Sales = Sum(Opportunity[Amount])
Total Sales LY = CALCULATE([Total Sales],SAMEPERIODLASTYEAR(Date_New[Date]))

 

PowerBI1.PNGPowerBI2.PNGPowerBI3.PNG

1 ACCEPTED SOLUTION
vanessafvg
Super User
Super User

@joshuavd might be worth a shot, but i see you have a smart datekey in your table, is your relationship between the tables (ie sales data to date table )on the smart key ie 20110101 or the date field - if its on the smart key change it to the date field





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
vanessafvg
Super User
Super User

@joshuavd might be worth a shot, but i see you have a smart datekey in your table, is your relationship between the tables (ie sales data to date table )on the smart key ie 20110101 or the date field - if its on the smart key change it to the date field





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I do have a date filter on the page that is only looking at 2017 (specifically 1/1/2017 - 6/30/2017). And the relationship is linked between sales close date (which is a short date format i.e. 1/15/2017) and the date field which is also a short date format (not the date key field)

Found the problem. My date filter was the sales close date and not the date table filter date. When I made that switch we're all good. Thanks!
Ashi
Helper I
Helper I

*Try This*

Keep a date slicer filter on the same page as that of a visual.

Select a particular date range in the same year(like 2016-01-01 to 2016-12-31)

 

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.