Power BI Hierarchy Slicer Display Employee Hierarchy Data
Good evening fellow developers, Here's how to display an employee hierarchy (employees and their supervisor/manager) using the Power BI Hierarchy Slicer custom visual. For this tutorial, I'm using the ContosoRetailDW database which can be downloaded from Microsoft's SQL Server database examples. This SQL Server database already has an Employee table of which an employee is assigned with a parentkey attribute. Next is to create a view that will be used as the Power BI's dataset. This view will has the employee name, employee id, manager name and manager id columns used in generating hierarchical levels in Power BI. Use ContosoRetailDW Go Create View vwEmployeeManager As SELECT [EmployeeKey] as [Employee ID] ,([FirstName] + ' ' + IsNull ([MiddleName], '' ) + ' ' + [LastName]) as [EmployeeName] , IsNull ([ParentEmployeeKey], 18) As [ManagerID] , IsNull (( Select [FirstName] + ' ' + IsNull ([MiddleNa