Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Above fig represent the hierarchy of my data.
This is my data and i want to calculate column to get who all are direct reportee and who all are my indirect reportee.
Example:-
for top number 1:- only 2 and 3 should be direct reportee for 1 and rest all should be indirect reportee (that are 4,5,6,7,8,9,10,11) for 1.(as show in fig).
for level 2:- I should get only 4,5 and 6 as direct reportee for 2 and remaining one that is 11 as indirect reportee for 2 only.
for level 3:- I should get only 7,8,9 and 10 as direct reportee for 3.
So please help me to solve this query.
Solved! Go to Solution.
HI @PrachiD,
My formula only drill down one level, if you want to expand more levels, you can add the filter to get its child employees.
Indirect = VAR direct = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] = MAX ( [Emp ID] ) ) ) VAR indirect = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] IN direct ) ) VAR child = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] IN indirect ) ) RETURN IF ( ISEMPTY ( indirect ) = FALSE (), CONCATENATEX ( UNION ( indirect, child ), [Emp ID], "," ) )
Notice: I haven't found a way to auto analysis all levels.
Regards,
Xiaoxin Sheng
Hi @PrachiD,
You can try to use below measure to achieve your requirement.
Direct = VAR direct = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] = MAX ( [Emp ID] ) ) ) RETURN IF ( ISEMPTY ( direct ) = FALSE (), CONCATENATEX ( direct, [Emp ID], "," ) ) Indirect = VAR direct = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] = MAX ( [Emp ID] ) ) ) VAR indirect = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] IN direct ) ) RETURN IF ( ISEMPTY ( indirect ) = FALSE (), CONCATENATEX ( indirect, [Emp ID], "," ) )
Regards,
Xiaoxin Sheng
I tired your query.
The problem is when we are calculating Indirect for Emp ID : 1 then in indirect list I should get 4,5,6,7,8,9,10,11 also
I shoud get the result as above
HI @PrachiD,
My formula only drill down one level, if you want to expand more levels, you can add the filter to get its child employees.
Indirect = VAR direct = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] = MAX ( [Emp ID] ) ) ) VAR indirect = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] IN direct ) ) VAR child = CALCULATETABLE ( VALUES ( Sheet5[Emp ID] ), FILTER ( ALLSELECTED ( Sheet5 ), [Manger ID] IN indirect ) ) RETURN IF ( ISEMPTY ( indirect ) = FALSE (), CONCATENATEX ( UNION ( indirect, child ), [Emp ID], "," ) )
Notice: I haven't found a way to auto analysis all levels.
Regards,
Xiaoxin Sheng
As it is a measure I cannot take count of Direct and Indirect so is it possible to get the count of the Direct and Indirect
For Direct Count, try this MEASURE
Direct Count = CALCULATE ( DISTINCTCOUNT ( TableName[Emp ID] ), ALLEXCEPT ( TableName, TableName[Manager ID] ) )
For Indirect Count, try this MEASURE
We will have to manually add levels when they increase in this Formula
Indirect Count = VAR level1 = INTERSECT ( ALL ( TableName[Manager ID] ), VALUES ( TableName[Emp ID] ) ) VAR level2 = INTERSECT ( ALL ( TableName[Manager ID] ), CALCULATETABLE ( VALUES ( TableName[Emp ID] ), level1 ) ) RETURN CALCULATE ( DISTINCTCOUNT ( TableName[Emp ID] ), UNION ( level1, level2 ) )
Thank You All
Is it posible to get the count instead of getting the id??
I will have to find automated solution only because the levels are going to increase
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |