Tu intento de usar LEAD
no funcionará porque no está sumando todos los niveles anteriores y sus ID deben ser secuenciales.
Desglose la jerarquía completa para cada empleado primero de modo que cada empleado se incluya una vez por nivel de jerarquía:
;WITH cte
AS
(
SELECT e.ID, e.Name, e.ID as sub_ID
FROM @Employees e
-- no WHERE-condition to get all employees
UNION ALL
SELECT
c.ID, c.Name -- keep the initial employee
,e.ID as sub_ID
FROM @Employees e
INNER JOIN cte c ON c.sub_ID = e.ParentID
)
SELECT
c.ID
,c.Name
-- parent level
,sum(case when c.id = s.EmployeeID then s.Quantity else 0 end) AS ParentSumSales
-- child level
,sum(case when c.id <> s.EmployeeID then s.Quantity else 0 end) AS ChildSumSales
FROM cte c
LEFT JOIN @Sales as s
ON s.EmployeeID = c.sub_ID
group by c.Name, c.id