cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dahdouhap Visitor
Visitor

Calculating Last Year YTD Sales with different table than actual net sales

Hello All, 

 

First Post Here. 

 

My question pertains to calculating YTD sales for the current and the previous year. 

 

I've seen other posts regarding the following formula: Total Sales LY = CALCULATE(SUM('Sales'[Today sales]), SAMEPERIODLASTYEAR('Date'[Date]))

 

However, it seems this assumes that the Prior Year data and current year data are in the same table. 

 

Is it possible to this calculation with 2 seperate tables one for CY and one for PY so that when i filter on the first 2 quarters it shows Q1 & Q2 of '17 and '18? 

 

Alex

1 REPLY 1
Super User
Super User

Re: Calculating Last Year YTD Sales with different table than actual net sales

Hi @dahdouhap

 

Yes, its possible . Assumeing that , your current year data in Table1, and last year data in Table2, then you can uset he below formula for LY.

Total Sales LY = CALCULATE(SUM(Table2[sales]), SAMEPERIODLASTYEAR('Date'[Date]))

Primiarily the filter is applied on your data table and then it flows to the table. Filter on Date differentaites the CY, LY values, not on the fact table.

 

Thanks

Raj