Hello I'm trying to generate a report in PowerPivot which recursively calculates the total number of employees reporting to a Manager. I have a typical Employee table as shown below.
If would like to filter by EmpID and the report should show me the count of the Employees reporting to the user grouped by the department. The Employee Count needs to be recursive to nth level rather than just 1 level.
[TABLE="width: 250"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]EmpID[/TD]
[TD]ManagerID[/TD]
[TD]Dept[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD]Operations[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]A[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]A[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]A[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]C[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]C[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]G[/TD]
[TD]D[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD][/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]I[/TD]
[TD]H[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]J[/TD]
[TD]I[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]K[/TD]
[TD]H[/TD]
[TD]Sales[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance
If would like to filter by EmpID and the report should show me the count of the Employees reporting to the user grouped by the department. The Employee Count needs to be recursive to nth level rather than just 1 level.
[TABLE="width: 250"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]EmpID[/TD]
[TD]ManagerID[/TD]
[TD]Dept[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD]Operations[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]A[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]A[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]A[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]C[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]C[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]G[/TD]
[TD]D[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD][/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]I[/TD]
[TD]H[/TD]
[TD]BackOffice[/TD]
[/TR]
[TR]
[TD]J[/TD]
[TD]I[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]K[/TD]
[TD]H[/TD]
[TD]Sales[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance