Forum Discussion

DanielM16's avatar
DanielM16
Frequent Visitor
5 years ago
Solved

SAMEPERIODLASTYEAR returns Blank

I have data that looks like this:   Cut-off Date Aux_Date Category Sales 23.01.2018 01.01.2018 A 1200 24.01.2019 01.01.2019 A 8900 25.01.2020 01.01.2020 A 6400 23.01.2018...
  • DanielM16's avatar
    5 years ago

    I actually found the solution myself. Changing the measure to the following does the trick:

    Sum_Sales_LY =
    var ly = SAMEPERIODLASTYEAR(Data[Aux_Date])
    return CALCULATE([Sum_Sales], all(Data[Cut-off Date]), Data[Aux_Date]=ly)