Forum Discussion
Lauco
5 years agoNew Member
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...
- 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
v-deddai1-msft
Community Support
5 years agoHi 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