PATHITEMREVERSE DAX function in Power BI
The PATHITEMREVERSE DAX function returns the item at the specified position from a string resulting from evaluation of a PATH function. Positions are counted backwards from right to left.
Syntax PATHITEMREVERSE(path, position[, type])
The function has the following parameters:
- path: A text string resulting from evaluation of a PATH function.
- position: An integer expression with the position of the item to be returned. Position is counted backwards from right to left.
- type: It is an optional parameter. It is an enumeration that defines the data type of the result:
- TEXT: 0 Results are returned with the data type text. (default).
- INTEGER: 1 Results are returned as integers.
Return value: The n-position ascendant in the given path, counting from current to the oldest.
Example: Let’s create a calculated column.
DAX
PATHITEMREVERSE Column = PATHITEMREVERSE( Employees[HierarchyPath], 3, INTEGER )
The output of the above code is shown below:
