Update for SQL Server 2022 (16.x) and later: LAG function can ignore NULLs.
LAG (scalar_expression [ , offset ] [ , default ] ) [ IGNORE NULLS | RESPECT NULLS ]
OVER ( [ partition_by_clause ] order_by_clause )
Default value is RESPECT NULLS. So username12345 source solution will work as he expected after adding IGNORE NULLS to the LAG function.
MS docs: https://learn.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-ver16