DAX Parent & Child - PATHITEM function



Description

Returns the item at the specified position from a string, resulting from an evaluation of a PATH function.

Positions are counted from the left to the right.

Syntax

PATHITEM (<path>, <position>, [<type>]) 

Parameters

Sr.No. Parameter & Description
1

path

A text string in the form of the results of a PATH function.

2

position

An integer expression with the position of the item to be returned.

3

type

Optional.

An enumeration that defines the data type of the result.

TEXT or 0: Results are returned with the data type text. (If omitted, this is default).

INTEGER or 1: Results are returned as integers.

Return Value

The identifier returned by the PATH function at the specified position in the list of identifiers

Items returned by the PATH function are ordered by the most distant to the current.

Remarks

  • This function can be used to return a specific level from a hierarchy returned by a PATH function.

  • If you specify a number for position that is less than one (1) or greater than the number of elements in path, DAX PATHITEM function returns BLANK.

  • If type is not a valid enumeration element, an error is returned.

Example

Suppose you want to return just the skip-level managers for all employees.

= PATHITEM(PATH(Employee[EmployeeID], Employee[ManagerEmployeeID]), 
   Employee[P ath Length]-2) 
dax_functions_parent_child
Advertisements