Básicamente, podría tomar esta respuesta y simplemente cambie una de las condiciones de unión:
SELECT
f.TimeKey,
s.AccountKey,
SUM(f.Debit) AS Debit,
SUM(f.Credit) AS Credit
FROM DimAccounts s
INNER JOIN DimAccounts b ON b.AccountCode LIKE s.AccountCode + '%'
/* alternatively: ON s.AccountCode = LEFT(b.AccountCode, LEN(s.AccountCode)) */
INNER JOIN FactBudget f ON f.AccountKey = b.AccountKey
WHERE s.AccountType = 'S'
AND b.AccountType = 'B'
GROUP BY
f.TimeKey,
s.AccountKey