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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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