Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
marcel97
Helper II
Helper II

Check if items appear in hierarchy with multiple criteria

Hello all,

 

I am managing a tool in my cooperation's project management office, where team leads are required to add their respective team members. 

 

As I suspect that some team leads are not maintaining their team members properly, I want to compare the list of resources form that tool with an official employee list from HR.

 

In that list from HR I find first and last name and the team name of the resource/employee/team member:

HR_DATA

TeamFirst NameLast Name
ADWDivisionHead
ADWSDepartmentHead
ADWS1TeamLead 1
ADWS1TeamMember 11
ADWS1TeamMember 12
ADWS1TeamMember 13
ADWS2TeamLead 2
ADWS2TeamMember 21
ADWS2TeamMember 22
ADWS2TeamMember 23

 

The team structure in my tool does not stop at the ADWSx level, but has even lower levels than that:

TEAM

IDParent_IDTeam NamePath
1 ADW1
21ADWS1|2
32ADWS11|2|3
43ADWS111|2|3|4
52ADWS21|2|5
65ADWS211|2|5|6
76ADWS2111|2|5|6|7

 

I also have a resource table in which all the employees with their respective team are listed

RESOURCE

TeamFirst NameLast Name
ADWDivisionHead
ADWSDepartmentHead
ADWS1TeamLead 1
ADWS1TeamMember 11
ADWS11TeamMember 12
ADWS11TeamMember 13
ADWS2TeamLead 2
ADWS2TeamMember 21
ADWS21TeamMember 22
ADWS211TeamMember 23

 

I now want to find out, whether all the resources that are listed in HR_DATA are also to be found in the same team or one of its subteams in my tool. Whats the best way to find out?

 

Thanks and kind regards

Marcel

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @marcel97 ,

 

Please try the following calculation columns:

 

FormatTeam = 
VAR length =
    PATHLENGTH ( RELATED ( TEAM[Path] ) )
VAR teamname =
    CALCULATE (
        MAX ( TEAM[Team Name] ),
        FILTER (
            ALL ( TEAM ),
            TEAM[ID] = VALUE ( PATHITEM ( RELATED ( TEAM[Path] ), 3 ) )
        )
    )
RETURN
    IF ( length <= 3, RELATED ( TEAM[Team Name] ), teamname )
IsContains = 
COUNTROWS (
    INTERSECT (
        { ( RESOURCE[FormatTeam], RESOURCE[First Name], RESOURCE[Last Name] ) },
        HR_DATA
    )
)

vkkfmsft_0-1641792643393.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @marcel97 ,

 

Please try the following calculation columns:

 

FormatTeam = 
VAR length =
    PATHLENGTH ( RELATED ( TEAM[Path] ) )
VAR teamname =
    CALCULATE (
        MAX ( TEAM[Team Name] ),
        FILTER (
            ALL ( TEAM ),
            TEAM[ID] = VALUE ( PATHITEM ( RELATED ( TEAM[Path] ), 3 ) )
        )
    )
RETURN
    IF ( length <= 3, RELATED ( TEAM[Team Name] ), teamname )
IsContains = 
COUNTROWS (
    INTERSECT (
        { ( RESOURCE[FormatTeam], RESOURCE[First Name], RESOURCE[Last Name] ) },
        HR_DATA
    )
)

vkkfmsft_0-1641792643393.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@marcel97 , do we have employee ID in table 1 and 3? like we have in table 2 - ID

Hey @amitchandak , table 1 does not have any IDs as it comes directly from HR and not from my tool. 

 

I simplified table 3 for data protection, but it does have IDs and would look like this:

 

IDTeamFirst NameLast Name
1ADWDivisionHead
2ADWSDepartmentHead
3ADWS1TeamLead 1
4ADWS1TeamMember 11
5ADWS11TeamMember 12
6ADWS11TeamMember 13
7ADWS2TeamLead 2
8ADWS2TeamMember 21
9ADWS21TeamMember 22
10ADWS211TeamMember 23

 

Kind regards

Marcel

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.