5
Answers

Get Managers and their assigned employees in hierarchy  in power bi

Photo of Kiran Kumar

Kiran Kumar

Feb 26
213
1

Get Managers and  their assigned employees in hierarchy  in power bi

Answers (5)

1
Photo of Tuhin Paul
37 35.4k 318.1k Mar 01

Say you are an HR manager who wants to:

  • Identify all employees reporting to a specific manager.
  • Analyze the distribution of employees across departments.
  • Drill down into teams to view individual contributors.

With the above setup:

  • You can filter by a manager (e.g., Alice) to see her direct reports (Bob and Charlie) and their subordinates (David, Eve, Frank).
  • You can use the organizational chart to visualize the entire company structure interactively.
  1. Data Quality : Ensure your dataset has no missing or incorrect ManagerID values.
  2. Performance Optimization : For large datasets, consider aggregating data or using DirectQuery mode.
  3. Custom Visuals : Explore additional custom visuals from the Power BI marketplace for advanced hierarchy representations.
Accepted
1
Photo of Tuhin Paul
37 35.4k 318.1k Mar 01

Option 2: Tree Map Visualization

  1. Use a Tree Map visual.
  2. Assign the following fields:
    • Group : ManagerName
    • Details : EmployeeName
    • Size/Color : Optional metrics like headcount or salary.

This will show the hierarchy in a nested, proportional layout.

Option 3: Table with Drill-Down

  1. Use a Table or Matrix visual.
  2. Enable drill-down functionality:
    • Drag HierarchyPath or FormattedHierarchyPath to the Rows field.
    • Add additional fields like Department or Job Title.
  3. Users can drill down from the top-level manager to individual employees.

Add Interactivity

Enhance the report with interactivity:

  1. Add slicers for filtering by department, location, or other attributes.
  2. Use bookmarks to highlight specific teams or managers.
  3. Add tooltips to display detailed information about employees when hovering over visuals.
1
Photo of Tuhin Paul
37 35.4k 318.1k Mar 01

Create a Self-Join Relationship

To establish the hierarchy, you need to create a relationship between the EmployeeID and ManagerID columns.

  1. Go to the Modeling tab in Power BI.
  2. Create a relationship between:
    • EmployeeID (Primary Key) in the same table.
    • ManagerID (Foreign Key) in the same table.
  3. Set the relationship type to Many-to-One (or One-to-One if applicable).

This self-join allows Power BI to understand the hierarchical structure.

Create a Hierarchy Column

You can create a calculated column to display the hierarchy path (e.g., "Alice > Bob > David").

  1. Go to the Modeling tab and click New Column .
  2. Use the following DAX formula to create a hierarchy path:
HierarchyPath = 
PATH(EmployeeTable[EmployeeID], EmployeeTable[ManagerID])

This will generate a string like "1|2|4" for David, indicating his position in the hierarchy.

  1. Optionally, format the hierarchy path as names instead of IDs using the LOOKUPVALUE function:
FormattedHierarchyPath = 
CONCATENATEX(
    PATHITEMREVERSE(EmployeeTable[HierarchyPath], [Value]),
    LOOKUPVALUE(EmployeeTable[EmployeeName], EmployeeTable[EmployeeID], [Value]),
    " > "
)

Visualize the Hierarchy

Now that the hierarchy is defined, you can visualize it in Power BI.

Option 1: Organizational Chart Visualization

  1. Use a custom visual like "Hierarchy Chart by Akvelon" or "Organizational Chart" from the Power BI marketplace.
  2. Add the visual to your report canvas.
  3. Assign the following fields:
    • Node Name : EmployeeName
    • Parent Node : ManagerID
    • Additional Fields : Department, Job Title, etc.

This will create an interactive organizational chart showing the manager-employee hierarchy.

1
Photo of Tuhin Paul
37 35.4k 318.1k Mar 01

To create a hierarchical view of managers and their assigned employees in Power BI, you can use a combination of data modeling, DAX (Data Analysis Expressions), and visualization techniques. This is a common real-world scenario where organizations want to visualize the organizational structure or employee-manager relationships.

Understand the Data Structure

You need a dataset that includes:

  • Employee ID : A unique identifier for each employee.
  • Employee Name : The name of the employee.
  • Manager ID : The ID of the employee's manager (this creates the hierarchy).
  • Other Attributes : Optional fields like department, job title, etc.

EmployeeID

EmployeeName

ManagerID

Department

1

Alice

NULL

Executive

2

Bob

1

Sales

3

Charlie

1

Marketing

4

David

2

Sales

5

Eve

2

Sales

6

Frank

3

Marketing

In this example:

  • Alice is the top-level manager (no manager above her).
  • Bob and Charlie report to Alice.
  • David and Eve report to Bob.
  • Frank reports to Charlie.

Load Data into Power BI

  1. Open Power BI Desktop.
  2. Load your dataset into Power BI using Get Data (e.g., Excel, SQL Server, or CSV file).
0
Photo of Emily Foster
679 1.3k 0 Feb 26

Absolutely, I'd be happy to help you understand "Get Managers and their assigned employees in hierarchy in Power BI".

In Power BI, to represent manager-employee relationships in a hierarchy, you can utilize the Parent-Child hierarchy feature. This feature allows you to build organizational charts or other reporting structures where managers are connected to their respective employees.

Here's a brief overview of how you can set up such a hierarchy in Power BI:

1. Data Structure: You need a dataset that includes columns for the manager's name and the employee's name, along with any other relevant data.

2. Creating the Relationship:

- In your data model, establish a relationship between the manager's name and the employee's name.

- This relationship should create a hierarchy where managers are at a higher level than their assigned employees.

3. Building the Hierarchy:

- Use the Parent-Child hierarchy feature in Power BI to define the relationship between the manager and employee columns.

- This will allow you to visualize the hierarchy in a tree structure, making it easy to navigate through different managerial levels.

4. Visualizing the Hierarchy:

- You can then use various Power BI visuals like the Organizational Chart or the Hierarchy Chart to represent the manager-employee hierarchy effectively.

Furthermore, you can leverage DAX (Data Analysis Expressions) to calculate additional metrics or perform specific calculations within the hierarchy if needed.

For example, here's a simple DAX measure that counts the number of employees reporting to each manager in the hierarchy:


Employees Count = COUNTROWS(FILTER('YourTableName', 'YourTableName'[Manager] = SELECTEDVALUE('YourTableName'[Manager]))

By employing these techniques in Power BI, you can create dynamic and visually appealing representations of manager-employee relationships in your reports or dashboards, offering valuable insights into organizational structures and team compositions. Let me know if you'd like more detailed information or specific examples!