Forum Discussion

iLikeAzureSQL's avatar
10 years ago
Solved

LastYear Sales same period not calculated properly

I need to have the sales for last year same period ( like 01/01/2015 to 06/10/2015) copmpared to this years to date sale   I'm using this DAX: LY YTD Sales = CALCULATE([LY Sales],SAMEPERIODLASTYEA...
  • Sean's avatar
    10 years ago

    iLikeAzureSQL these functions need context to work properly like in a table/matrix with a YEAR field

     

    This is obviously not present in a Card!

     

    So for a Card use something like this instead...

    LY Sales =
    CALCULATE (
        [Total Sale],
        FILTER ( 'Calendar', 'Calendar'[Year] = MAX ( 'Calendar'[Year] ) - 1 )
    )