Calculate Average with Hierarchy