Hi All,
I’m trying to build an Iterative Macro in Alteryx to traverse an organizational hierarchy and identify each employee’s reporting chain until the MD level is reached.
Each record contains an employee and their immediate manager. The challenge is that:
I believe an Iterative Macro is the correct approach, but I’m struggling with the loop logic and stop condition.i have attached image for reference
@mohamedshan1996 https://community.alteryx.com/t5/Weekly-Challenges/Challenge-12-Creating-an-HR-Hierarchy/td-p/36740
I have built an iterative macro in the past using this post and download as a guide: https://community.alteryx.com/t5/Engine-Works/Building-a-Hierarchy-With-Kevin-Bacon/ba-p/453715If I were you I would approach the problem as finding everyone's complete reporting chain, and then transposing/joining/filtering the results to find the Managing Director for each employee (Group on Employee ID and transpose all Manager IDs, Join in the Managers’ titles based on those IDs, and then filter to Managing Directors). It's definitely possible to make it stop iterating once it results in a certain job title, but most examples you can find and build off of are going to have logic that has them go until the chain stops, and at that point you can just use your typical tools rather than messing around with iterative logic.