This is the line.
DECLARE @Duration DATETIME = '2019-01-12'
DECLARE @DateFrom DATETIME = CONVERT(DATETIME, DATEADD(dd, -90, CONVERT(VARCHAR(10), @Duration)))
SELECT @DateFrom
This is the error message
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
and the sql results is NULL but 1 row affected.