Forum Discussion

Yuziu8o's avatar
Yuziu8o
New Member
9 months ago
Solved

Ned help with Path DAX

I am working on a hierarchy table where each row has an EmployeeID and a ParentID. I used the PATH function to build the full chain for every employee. Now I need to check if a specific manager exist...
  • Shubham_rai955's avatar
    9 months ago

    To check if a specific manager exists in an employee's PATH chain using DAX, use the PATHCONTAINS function. It returns TRUE if the manager's EmployeeID is anywhere in the PATH string.

    Example measure or calculated column:

     
    ManagerInPathFlag = IF ( PATHCONTAINS(EmployeeTable[Path], ManagerID), 1, 0 )
    • EmployeeTable[Path] is the column created by the PATH function.

    • ManagerID is the specific manager's ID you want to check within the path.

    This flags rows with 1 when the manager appears in the hierarchy chain and 0 otherwise.