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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Year-to-Date Equations pulling Sales from Prior years when null in the current YTD period

Here is my current YTD equation: 

FYTD22 Sales = TOTALYTD(PBI_MSR[TotalSales], PBI_MSR[CosDate], "06/30")
FYTD21 Sales = CALCULATE(TOTALYTD(PBI_MSR[TotalSales], PBI_MSR[CosDate], "6/30"), SAMEPERIODLASTYEAR('Calendar'[Date]))
 
This equation populates with the perfect sales numbers when there are sales within the time period but when there haven't been sales it pulls in incorrect data. Here is an example of what happens:
MI10590_0-1628884109029.png

As you can see the Rolling 12 Month, FY21, FY20, FY19, FY18, sales are all zeros and therefore my YTD equations for FYTD22 and FYTD21 should show zeros as well but its pulling sales from FY17 (the last year there was sales) forward instead of leaving it blank. 

 

Here are my equations for Rolling 12 and the full fiscal years for referecne:

 

Rolling 12 Month Sales =
CALCULATE([TotalSales], DATESBETWEEN('Calendar'[Date], NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Calendar'[Date]))), LASTDATE('Calendar'[Date])))
 
FY2021 Sales = CALCULATE(sum(PBI_MSR[ExtendedPriceFull]),DATESBETWEEN(PBI_MSR[CosDate],DATE(2020,7,1),DATE(2021,6,30)))
Status: New
Comments
v-chuncz-msft
Community Support

@MI10590 

 

You may check Cross filter direction and take a look at this article. For any question about data shaping, modeling, and report building in the Power BI Desktop app, feel free to post a new message in Desktop forum.