Thank you so much - that works!
Meanwhile I was playing with my own code, and I think I got an alternate solution using nested cases:
SELECT
OpportunityID,
ActivityID,
FirstVisit,
ScheduledEnd,
CASE
WHEN CONVERT(DATE, ScheduledEnd) = FirstVisit
THEN
CASE...