I think this is what are you looking for.
Done with MSSQL.
DECLARE
@EmpName VARCHAR(50),
@Month INT
SET @EmpName = 'A'
SET @Month = 3
SELECT @EmpName Emp, @Month Month,
(SELECT SUM(Sales) FROM dbo.[Table] WHERE (Employee = @EmpName OR Manager = @EmpName) AND Month = @Month) TeamSales,
(SELECT SUM(Sales) FROM dbo.[Table] WHERE (Employee = @EmpName OR Manager = @EmpName) AND Month <= @Month) 'MTD Team Sales'
Table structure:
Name: table
Month int Checked
Employee varchar(50) Checked
Sales int Checked
Manager varchar(50) Checked
Values in Table:
Month Employee Sales Manager
1 A 100 D
1 A 150 D
1 A 200 D
1 A 250 D
1 A 300 D
1 A 350 D
1 A 200 D
3 B 350 A
1 B 400 A
1 B 450 A
2 C 100 A
2 C 200 A
2 C 250 A
2 C 300 A
2 C 400 A
3 B 500 A
3 B 500 A
3 B 450 A
3 B 450 A
3 B 450 A
3 A 500 D
3 A 500 D
3 A 250 D
1 C 200 A
1 C 200 A
1 C 150 A
3 C 150 A
3 C 150 A
3 C 150 A
1 B 250 A
1 B 250 A
3 C 150 A
2 B 150 A
2 B 250 A
2 A 250 D
2 A 250 D