• A solution, perhaps not the best one, is to use a query like

    WITH DistinctOrg as (

    select distinct ID, Director, Manager, AssistantManager, Region, Account from OrgStructure)

    select D.AssistanManager, SUM(S.Value) as TotalValue

    from DistinctOrg D inner join SalesByValue S on D.Account = S.Account and D.Region = S.Region ;

    Rolling up to a higher level -

    for Manager: replace all occurrences of DistrictManager in the query by Manager (and, if you want to be tidy, make sure Manager occurs only once in any select list by eliminating one occurrence when Manager is duplicated)

    for Director: starting with the Manager version, replace all occurrences of Manager by Director (and clear up repeats of Director in the select list).

    Of course if the version for manager can simply be the version for assistant manager if each manager controls only one assistant manager, and similarly the version for director isn't needed if each director controls only one manager, but it would be foolish to assume that you can get away without the additional versions - organisations change from time to time.

    Or you can create the three auxiliary tables as ordinary tables instead of generating them on demand using CTEs if the performance difference outweighs the table space difference.

    Tom