Forum Discussion

GMS0101's avatar
GMS0101
Frequent Visitor
7 years ago
Solved

SAMEPERIODLASTYEAR only calculating cumulative amounts

Hello! I've seen many forum pages and blogs of people using a combinatio of CALCULATE and SAMEPERIODLASTYEAR to calculate prior period revenue but my formulas to get prior period revenue return the ...
  • v-xuding-msft's avatar
    7 years ago

    Hi GMS0101 ,

    You need to create a new calendar table and create a relationship between the two tables.

    Table = CALENDARAUTO()

    Prior Period Sales   = CALCULATE(sum(MyTable[Sales]),DATEADD('Table'[Date],-1,YEAR))
    Prior Period Sales 2 = CALCULATE(SUM(MyTable[Sales]),SAMEPERIODLASTYEAR('Table'[Date]))
    

    Note:

    • The date in tables is from calendar table.
    • Due to we calculated the sales of previous year, it only can be shown as year and entire date, like the pic above. We can't drill down to quarter , month and day.

    I attached my sample that you can reference.

     

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.