Forum Discussion

michaelstone's avatar
michaelstone
Helper I
7 years ago
Solved

Strange behaviour with SAMEPERIODLASTYEAR

Hi,   I'm building a Power BI report which is analysing PoS transaction data so have a fact table (Transactions) with every individual transaction including timestamp and sales amount (Transactions...
  • v-piga-msft's avatar
    v-piga-msft
    7 years ago

    Hi michaelstone ,

    Sorry for my mistake.

    Please modify the measure Total Sales - Previous Year  like below.

    Total Sales - Previous Year =
    SUMX (
        'Calendar',
        CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )
    )
    

    Here is the output.

    Best  Regards,

    Cherry