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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
vsatamraju
Employee
Employee

Creating a Hierarchy in Power BI

Hi All,

 

We are Clustered Column Chart in Power BI.

We are implementing the drill down feature for employee heirarchy from top to bottom according to the Organization depth. Now we want to show the Count of direct as well as indirect for each manager.

 

How can we do this ?

 

Thanks in Advance

11 REPLIES 11
Habib
Responsive Resident
Responsive Resident

You need help regarding hierarchy creation or to show the count for direct/indirect?

I am looking top show the count 

Sorry ,its a type mistake.

 

We are looing for Count of employees under each manager direct and indirect reportees.

 

Thanks in Advance

@vsatamraju

 

Suppose the dataset is as the 3 columns highlighted. Create a calculated column [path] and table [calculatedTable] as below. Then use a measure subordinates in the chart.


Capture.PNG

path = PATH(Employees[Name],Employees[Parent])

CalculatedTable =
FILTER (
    CROSSJOIN (
        FILTER (
            ALL ( Employees[Name], Employees[Title] ),
            Employees[Title] = "manager"
        ),
        ALL ( Employees[path] )
    ),
    PATHCONTAINS ( Employees[path], Employees[Name] )
)

subordinates = COUNTA(CalculatedTable[path])-1

You can check more details in the attached pbix. Also check Understanding Functions for Parent-Child Hierarchies in DAX.

 

If it solves your problem, please accept it as solution. For any question, feel free to let me know.

Where to enter the 

CalculatedTable ?

 

Hi Eric, 

 

Thank you for this interesting piece of code; however, where do you enter the code for calculatedtable? 

Hi Eric, 

 

Thank you for this interesting piece of code; however, where do you enter the code for calculatedtable? 

@Eric_Zhang

Thanks a lot Eric, this has solved my problem. I wouldn't have been able to do it without this post; kudos.

Where does this code go?

@Eric_Zhang ,

 

I havent start this, i will let you know once i started.

ankitpatira
Community Champion
Community Champion

@vsatamraju to be able to create drill down in power bi visuals you need to drop multiple fields into Axis area. provided you have columns of organisational level, manager and count of employees you can use Pivot column feature in query editor in power bi desktop to seperate out organisational level as individual columns. you can then drop those fields into Axis area and count of employees onto Value area. 

 

The way you operate this depends on the structure of your data.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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