Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

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]))

 

 

 

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

 

 

 

 

How is this possible? Any Ideas?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 Replies

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

  • v-sihou-msft's avatar
    v-sihou-msft
    Microsoft 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,