Calculate hierarchy count fnc in progress