Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dahdouhap
Regular 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
Anonymous
Not applicable

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.