PATHCONTAINS

The PATHCONTAINS function returns the logical value True if the specified element exists in the path.

Syntax

PATHCONTAINS(
    path,
    item
)

Parameters
  • path: Text string generated with the PATH function.
  • item: Element to find in the text string path.
Returned value

The PATHCONTAINS function returns a Boolean.

Additional Information

If item is a number, it is converted to text before searching. If the conversion fails, the PATHCONTAINS function returns an error.

Examples

We start from the following table:

Functions of parents and children. Data table

This table contains worker identifiers and the hierarchical relationship between them. The scheme of this hierarchy is shown in the following figure:

Functions of parents and children. Hierarchy

Once the path of each employee has been extracted, we can check which ones have employee 162 as their hierarchical superior with the following DAX expression:

contains_162 = PATHCONTAINS(Employees[path], "162")

PATHCONTAINS function. Example of use

Since the path of an element includes the identifier of the element itself, the employee with identifier 162 also appears with the label True in the created column.

Category
Parent and child
Submitted by admin on Fri, 01/25/2019 - 11:34