Forum Discussion
Lookup Manager's name from same table
See the simple table below, with Employee ID and Name, and the Manager's ID (which is also a row in the table. I found the PATH and PATHLENGTH functions, thinking they could help me disply another column with the Manager's name for each employee. If it was a lookup from another table, I think I could do that, but looking up another row in this table is not working for me. How would I do that? Thank you in advance.
https://www.daxpatterns.com/parent-child-hierarchies/
Assuming the table has this data
Added these 3 columns (and not measures), see if this works the same as you needed!
Path Function = PATH(Table1[Employee ID], Table1[Manager ID]) Path Length = PATHLENGTH(Table1[Path Function]) Manager Name = LOOKUPVALUE( Table1[Employee Name ], Table1[Employee ID], Table1[Manager ID])Output:
Hope this helps!
3 Replies
- sevenhillsSuper User
https://www.daxpatterns.com/parent-child-hierarchies/
Assuming the table has this data
Added these 3 columns (and not measures), see if this works the same as you needed!
Path Function = PATH(Table1[Employee ID], Table1[Manager ID]) Path Length = PATHLENGTH(Table1[Path Function]) Manager Name = LOOKUPVALUE( Table1[Employee Name ], Table1[Employee ID], Table1[Manager ID])Output:
Hope this helps!
- AnonymousNot applicable
Seven Hills,
You are a Super DUPER User! I tried LOOKUPVALUE, and ended up with a lot of trash, but I must have had the wrong fields. Your solution is perfect! Thank you for a quick answer! 🙂
- sevenhillsSuper User
Glad to hear that it worked. Thanks