The error is coming up because [Daily - Spend - Target] is not aggregated, but the expressions inside your 'DATEDIFF' expression are being aggregated by that date function. Tableau requires that these to both be aggregated in order for you to run your code, so here's a common fix for this: you apply a 'fake' aggregation to your non-aggregated variable.
Try wrapping [Daily - Spend - Target] in a "MAX()", "Min()", or "ATTR()" function. These are all aggregating functions that could potentially fix your error.
IF DATEDIFF('day', [End Dates], [Dates]) = -1
then ATTR([Daily - Spend - Target])
I hope that helps!