I think the problem with running it multiple times is the line below
cnt = COUNT(*) over (partition by OriginalTargetDate)
Because the OriginalTargetDate values are no longer unique. I changed that line to below and it seems to work.
cnt = COUNT(*) over (partition by DATEADD(d,DATEDIFF(d,0,OriginalTargetDate),0))
I ended up using the SELECT MAX FROM VALUES option as shown below