Forum Discussion

Viraj16Agate's avatar
Viraj16Agate
Regular Visitor
4 years ago

Sales Last year

Hi,

 

I have sales data for last 3 year on different sales channel as below

 

SalesChannel      Date                Sales
A                     01-10-2020        51454
A                     01-10-2019        42380
A                     01-10-2018        35896


 

I need to format this to have dates with only recent 12 months and then additional columns with salesLY (last year sales for same channel and same period) and salesLY2 (2 year earlier sales for same channel and same period) as below

 

SalesChannel     Date                 Sales          salesLY       salesLY2
A                     01-10-2018         51454        42380         35896

 

can anyone please suggest solution for this

Thanks in advance!

1 Reply

  • Tanushree_Kapse's avatar
    Tanushree_Kapse
    Icon for Impactful Individual rankImpactful Individual

    Hi Viraj16Agate ,

     

    Use below measures:

     

    salesLY= CALCULATE(SUM(Table[Sales]), PARALLELPERIOD(Table[Date], -1, YEAR))
    salesLY2= CALCULATE(SUM(Table[Sales]), PARALLELPERIOD(Table[Date], -2, YEAR))

     

    Mark this as a solution, if I answered your question. Thanks