Forum Discussion

Lauco's avatar
Lauco
New Member
5 years ago
Solved

Total Cumulative Sale Last year

Hello,    I am trying to compare total cumulative this year vs total cumulative last year. For this year it works perfectly well but when i am introducting the formula same period last year, i...
  • v-deddai1-msft's avatar
    5 years ago

    Hi Lauco ,

     

    You can try the following measure:

    TotalsalesCy = CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date])&&YEAR('Date'[Date]) = YEAR(MAX('Date'[Date]))))
    
    TotalsalesLY = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR(CALCULATETABLE(VALUES('Date'[Date]),FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date])&&YEAR('Date'[Date]) = YEAR(MAX('Date'[Date]))))))
    
    or you can use the following measure for last year cumulative sales:
    
    Lysales = CALCULATE([TotalsalesCy],SAMEPERIODLASTYEAR('Date'[Date])) 

     

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

     

    Best Regards,

    Dedmon Dai