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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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