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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SivaMani
Resident Rockstar
Resident Rockstar

Multilevel Hierarchy(Managerial Hierarchy) - Manager and Employee

Hi,

 

Sample Data:

DirectManagerEmployeeExpenseMgrIDPersonID
Mgr1Mgr210010011002
Mgr2Mgr35010021003
Mgr2Emp12510021004
Mgr3Emp23010031005

 

I need to create a table containing mutilevel hierarchy .I used PATH function to achieve that , but it throws up an error stating Mgr 1 should also exist in Employee column. Need some assistance in this.

 

Thanks in advance.

7 REPLIES 7
Zubair_Muhammad
Community Champion
Community Champion

@SivaMani 

 

You will need to add Mgr1 both as an Employee and DirectManager for PATH function to work

PathSM.png

 

If you cannot directly input this row in your database,

You can add a row with Power Query by adding this step from the Query Editor (File attached)

 AddRow = Table.Combine({#"Changed Type",#table(type table[ #"DirectManager"=text, #"Employee"=text], {{"Mgr1","Mgr1"}})})
in
  AddRow

 


Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad .

 

I have resolved this issue with a similar approach. 

 

I have another challenge to visualize this data. I need to represent this in a Matrix visual. Here is the example,

[-] Mgr1

   [-] Mgr2

       Emp1

      [+] Mgr 3

 

I created 3 new columns and attained this requirement using PATHITEM function. Is there any alternative approach to minimize this effort?

Hi @SivaMani 

 

Alternate is to use Power Query to replicate the PATH function.

Then we can split the PATHs in one step into multiple levels

 

This avoids the problem of having to manually create PATH levels when we use PATH (DAX) function

I wrote a blog post about it

http://www.excelnaccess.com/replicating-path-function-of-dax-in-power-query-m/

This approach could be slow for large datasets since it uses a recursive function.
But (I believe) since PATH function is applied to DIMENSION tables mostly...this approach can be very handy

 


Regards
Zubair

Please try my custom visuals

Great!

 

Thanks @Zubair_Muhammad .

Hi @Zubair_Muhammad ,

 

I have tested M query option. It is too slow. My dimention data file size is 715 KB with 8 columns and 8410 records.

 

After I applied the function, it is processing more than 11 GB and it seems to never end.

@SivaMani 

 

Could you share your file with me?


Regards
Zubair

Please try my custom visuals

Sorry @Zubair_Muhammad .

 

I can't share my file - it contains senstive data. I'm facing this problem as a common issue. 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.