PATHITEMREVERSE

Updated on

PATHITEMREVERSE is a DAX function that returns the nth item from the end in a delimited path string generated by the PATH function.

Syntax

PATHITEMREVERSE(
   Path,
   Position,
   Type
)
Argument Properties Description
Path A string which contains a delimited list of IDs.
Position An integer denoting the position from the right end of the path.
Type Optional Optional. If missing or 0 then this function returns a string. If 1 then this function returns an integer.

Return Values

The n-position ascendant in the given path, counting from current to the oldest.

Remarks

  • This function can be used to get an individual item from a hierarchy resulting from a PATH function.

  • This function reverses the standard order of the hierarchy, so that closest items are listed first, For example, if the PATh function returns a list of managers above an employee in a hierarchy, the PATHITEMREVERSE function returns the employee’s immediate manager in position 2 because position 1 contains the employee’s id.

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

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

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example

The following example takes an employee ID column as the input to a PATH function, and reverses the list of grandparent elements that are returned. The position specified is 3 and the return type is 1; therefore, the PATHITEMREVERSE function returns an integer representing the manager two levels up from the employee.

= PATHITEMREVERSE(PATH(Employee[EmployeeKey], Employee[ParentEmployeeKey]), 3, 1)

Other functions related to PATHITEMREVERSE are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/pathitemreverse-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy