Working in Tableau Prep 2018.2 (company is planning an updgrade soon).
I am trying to calculate DateDiff when certain fields in my data set meet criteria. After creating and IF/THEN with a DateDiff formula, I continue to run into issues where the field does not appropriately calculate and/or the results are blank. See attached screenshots, workflow, and data.
When I open your flow, I immediately see the following error:
Your DATEDIFF calculation in the existing calc needs to change "days" to "day".
IF [Recommendation State] = "Open"
THEN DATEDIFF('day',[Estimated Implementation Date],TODAY())
ELSE DATEDIFF('day',[Actual Implementation Date],TODAY())
END
But onto your actual question, try the following and it should return results:
IF ISNULL([Actual Implementation Date]) THEN
DATEDIFF('day',[Estimated Implementation Date],TODAY())
ELSE
DATEDIFF('day',[Actual Implementation Date],TODAY())
END
See attached.