Mario:
It determines each separately. It first must find a department. Then it tries to find a unit which must belong to the department. Lastly it would determine a specialist who belongs to that unit. You can only have three levels - so i am not clear how you intend to use sub-group since that does not align with the standard design.
regards,
bill.