# YoY Comp that changes to YTDoYTD for Current Year

Hello All,

I am hoping someone might know a way to calculate a YoY % Change that will switch over to a YTD over YTD on the recent Year so that it is not skewed doing the Current YTD over the Full Past Year.

I’m using a Row Header for Customers and a Column Header for Year, like this:

Here is my current Measure that fails when adding in the YTD ability I want:

``````YoY % with Current YTD =
VAR FYCurrentSales = [Gross \$ -Cust Metric]
VAR FYPreviousSales = CALCULATE( [Gross \$ -Cust Metric], DATEADD( '*Dates'[Date], -1, YEAR) )
VAR FYDeltaSales = FYCurrentSales - FYPreviousSales
VAR FYResult =
IF (
NOT ISBLANK ( FYCurrentSales ),
DIVIDE ( FYDeltaSales, FYPreviousSales )
)
VAR CurrentYear = YEAR(TODAY())
VAR SelectedYear = VALUES( '*Dates'[Year])
VAR YTDCurrentSales = [Gross \$ -Cust Metric -YTD]
VAR YTDPreviousSales = [Gross \$ -Cust Metric -YTD 1Y]
VAR YTDDeltaSales = YTDCurrentSales - YTDPreviousSales
VAR YTDResult =
IF (
NOT ISBLANK ( YTDCurrentSales ),
DIVIDE ( YTDDeltaSales, YTDPreviousSales )
)
RETURN

IF( SelectedYear = CurrentYear, YTDResult, FYResult)``````

Probably will need an example file on this one as there’s a number of variables here that need to be taken into account…

Your formula actually looks quite close to me to what you would require here. What results are you getting instead?

There’s just a bit going on here, I’m finding it to difficult to see without having some demo to work on.

Thanks
Sam