PATHITEMREVERSE function


Advertisements

Description

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

Positions are counted backwards from the right to the left.

Syntax

PATHITEMREVERSE (<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.

Position is counted backwards from the right to the left.

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 nth position ascendant in the given path, counting from the current to the oldest.

Remarks

  • DAX PATHITEMREVERSE 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 the 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 as 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 PATHITEMREVERSE function returns BLANK.

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

Example

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

Returns the immediate managers of each employee.

dax_functions_parent_child

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements