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

SAMEPERIODLASTYEAR doesn't return expected values

When creating a Calculate function with SAMEPERIODLASTYEAR Power BI returns the same values as the current period when using a custom YEAR-MONTH hierarchy.

As a measure I use Verkoopwaarde SPLY = CALCULATE(SUM(Sales[Sales]),SAMEPERIODLASTYEAR(Date[DATUM].[Date]))

 

 

SMLY not working.jpg

 

When I create the same measure with the date column (Power BI then creates its own hierarchy) the correct values are returned.SMLY working.jpg

 

 

 

 

How is this possible? Any Ideas?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 REPLIES 2
v-sihou-msft
Employee
Employee

@Anonymous

 

When using SAMEPERIODLASTYEAR function, you must use a date column with contigous, unique date values. It can't evalute expression like [column].[Date] as contigous dates. So please always directly put the date column in any time intelligence function.

 

Regards,

Gracie
Helper II
Helper II

I guess since SAMEPERIODLASTYEAR function requires a column containing dates. When you use the date column in your Date Table to do the calculation, you need to use the same date key column or hierarchy in the Date table to visual to show the correct data.

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.