PATHITEMREVERSE Function (DAX)

How does the PATHITEMREVERSE function (DAX) work?

The PATHITEMREVERSE function (DAX) 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.

PATHITEMREVERSE Formula Syntax

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

How do you use the PATHITEMREVERSE function?

  • 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.

Related Blog Posts

Related Support Forum Posts

Dax Calculation question
Dax not working
DAX Buffer Calculation Query

Considerations when using the PATHITEMREVERSE function

  • 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.

Related Video Tutorials

Formula examples using the PATHITEMREVERSE function

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

= PATHITEMREVERSE(PATH(Employee[EmployeeID], Employee[ManagerEmployeeID]), 2)

= PATHITEMREVERSE(‘ParentChild'[cPath],3,INTEGER)

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.