Something like (maybe you need to swap 1 and 0, unverified)
datediff(month,[DateEngaged],getdate()) +
CASE WHEN DATEPART(day, [DateEngaged]) < DATEPART(day, getdate()) THEN 1 ELSE 0 END
DATEDIFF measures monthly boundaries, for example, 00:00, on the 1st of each month, and not the anniversary dates of the month.
Edit: after viewing the OP comment, you should subtract 1 if the start day> end of the day
DATEDIFF (month, DateEngaged, getdate()) -
CASE
WHEN DATEPART(day, DateEngaged) > DATEPART(day, getdate()) THEN 1 ELSE 0
END
So, from December 20 to January 13, DATEDIFF gives 1, and then 20> 13, so subtract 1 = zero months.
source
share