Thanks for your post.
I created a very trimmed down view still containing lag/lead based on your example and it seems to work OK based on a quick commit / get to a different database.
What version of SQL Source Control are you working with? Are you able to supply the relevant table definitions needed by your example view so I can come up with a full working example? (please feel free to mail these to email@example.com
quoting F0074030 in the subject line if so)