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
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
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.