Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I want to write expression as to how many employees are reporting to particular manager. If there are no reportees then 0 should be displayed otherwise count of repotees should be displayed in straight chart..
Please help me ...
Hi
PFA
as per your data eno: 1 has manager id , and eno2 should be 0 as there is no manager id
Immediate Try this in your expression
if(MangerID='' ,'',count(TOTAL <MangerID>EmpName))
'' means NULL
Please find the data
EMp:
LOAD * INLINE [
EMPno, EmpName, MangerID
1, A, 2
2, B
3, C, 4
4, D, 2
5, E, 4
6, F, 5
];
and I want to show the result using straight chart
Empno | No of Reportees |
1 | 0 |
2 | 2 |
3 | 0 |
4 | 2 |
5 | 1 |
6 | 0 |
ManagerId will be same as the Empno
Still not clear with your data
pfa
may helps you
LOAD * INLINE [
EmpNo, EmpName, MangerID
1, A, 2
2, B,
3, C, 4
4, D, 2
5, E, 4
6, F, 5
7, S, 2
];
I find this Output and I thin this is okay,
there are 3 employees who report to managerID 2
similarly 2 employees report to managerID 4
What Output you exactly want.
Its not clear
Plz share your complete data,
I think there are more information which is not clear to us,
How can be no of reportees 0 for empno 1 ,
while empno 1 reports to ManagerID 2 and also empno 4 reports to managerID 2,
so for empno 1 there should be 2 no of reportees,
A self-join would be useful, try like:
Input:
LOAD * INLINE [
EMPno, EmpName, MangerID
1, A, 2
2, B
3, C, 4
4, D, 2
5, E, 4
6, F, 5
];
Left Join
Load
MangerID as EMPno,
EMPno as Manager
Resident Input;
PFA
For Empno 1 is not in MgrId so he won't be having any reportees so count of Reprotees will be 0
similarly Empno 2 there are 3 employees reporting to him.. EmpNo 1,4,7 So count of Reprotees will be 3
Like wise for all employees i want..
Is this clear now?
Thank you very much tresesco
Thanks all for your replies..