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 ...
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
Like this?
Dimension: manager
Exp: Count( Distinct employees)
Hi Lokeshwari,
You can try what tresesco have suggested or you can use Aggr function in complex case. Can you share your app? It will be helpful to understand better.
Regards
KC
Hi Lokeshwari,
You can do it by using Pivot table,
Dim1: ManagerName
Dim2: EmployeeName
Expression: count(EmployeeName)
and apply show partial sum on Dim2,
Try it
may this helps you
if(Count( Distinct employees)>0,Count( Distinct employees),0)
Hi,
For Straight Table,
Dim1: Manager
Dim2: Employee
Exp is
count(Total <Manger>Employee)
And for Null or Missing Values, Change '-' into 0 in Properties->Presentation
I am sure it will work
Hi,
Use AGGR() it will work .
aggr( distinct count(empID), MngrID)
Regards,
khalander
But still it is not giving correct value... I have an example as below
EMp:
LOAD * INLINE [
EMPno, EmpName, MangerID
1, A, 2
2, B
3, C, 4
4, D, 2
5, E, 4
6, F, 5
];
But in chart when i applied the expression it is coming like this
For Empno--1 Reportees 0 should come but it is diplaying as 1
But It is not working .Here is my data in script
EMp:
LOAD * INLINE [
EMPno, EmpName, MangerID
1, A, 2
2, B
3, C, 4
4, D, 2
5, E, 4
6, F, 5
];
For example for Empno-1 the number of reportees should come 0 since he is not manager to any of the
employees..
try:
if(len(trim(Reporte))>0,count(Reporte),0)
Regards
KC