MinutesInAdvanceCancelled= CASE WHEN datediff(minute,canceldate,begintime) < 0 THEN 0 ELSE datediff(minutes,canceldate,begintime) END>Below is the query SP I'm trying to write. I need to determine how many minutes in advance a case was cancelled. The system stores the Begintime as the scheduled start of a case. The canceldate field hold the datetime it was cancelled. Sometimes cases are cancelled after the scheduled start time (begintime), these I want to return as a zero. Otherwise, I want to return the number of minutes that the case was cancancelled before it's original begin time.