Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PrintDream
Regular Visitor

Recursive Hierarchy; Managers and Employees

Hello PowerBI Community!

 

I am trying to accomplish an organizational hierarchy report based on a table Managers and Users. Sample data below:

PrintDream_0-1657817804018.png

As you can see, every employee should have a managerID associated to them.

 

The best visualization will most likely come from a Matrix or a Hierarchy Slicer, but it seems the dropdowns are not as recursive as I need them to be (i.e. Manager456->Manager123 should have the users of Manager123):

PrintDream_2-1657818414689.png

 

I assume I will need to write a query to build this heirarchy, but I do not know how many levels up/down I will have, so adding Paths/columns will not work here. Any anecdotes, examples or pointers are much appreciated.

 

Thanks,

PrintDream

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PrintDream ,

 

1. Here is a blog talking about similar issue, please check if it helps.

Power BI Tips & Tricks: Filter by Manager Hierarchy

Eyelyn9_2-1658289923185.png

 

2.Or you may try merge:

 

Eyelyn9_1-1658288109333.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8jU0MlbSUQoFUbE6WPgmpmZAvi8aP9TcwlIpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ManagerID = _t, UserID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ManagerID", type text}, {"UserID", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"UserID"}, #"Changed Type", {"ManagerID"}, "Changed Type", JoinKind.LeftOuter),
    #"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"UserID"}, {"Sub.UserID"})
in
    #"Expanded Changed Type"

Eyelyn9_0-1658288097266.pngEyelyn9_3-1658290108643.png

 

More threads:

Solved: Manager Level Hierarchies with multiples in Power ... - Microsoft Power BI Community

How to create end to end Hierarchy Column in Power BI to show Parent Child Relationship - YouTube

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PrintDream ,

 

1. Here is a blog talking about similar issue, please check if it helps.

Power BI Tips & Tricks: Filter by Manager Hierarchy

Eyelyn9_2-1658289923185.png

 

2.Or you may try merge:

 

Eyelyn9_1-1658288109333.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8jU0MlbSUQoFUbE6WPgmpmZAvi8aP9TcwlIpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ManagerID = _t, UserID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ManagerID", type text}, {"UserID", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"UserID"}, #"Changed Type", {"ManagerID"}, "Changed Type", JoinKind.LeftOuter),
    #"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"UserID"}, {"Sub.UserID"})
in
    #"Expanded Changed Type"

Eyelyn9_0-1658288097266.pngEyelyn9_3-1658290108643.png

 

More threads:

Solved: Manager Level Hierarchies with multiples in Power ... - Microsoft Power BI Community

How to create end to end Hierarchy Column in Power BI to show Parent Child Relationship - YouTube

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Familiarize yourself with the PATH functions.  Also figure out if your hierarchy is well defined or (more likely) ragged.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors