OpenBI Docs Buy

PATHITEMREVERSE

The key at a position in a PATH text, counted from the current row up.

Group: Parent and child. Compatible with DAX.

Syntax

PATHITEMREVERSE ( <path>, <position> [, <type>] )
ParameterTypeDescription
pathTextA path as PATH writes it: keys separated by |.
positionWhole numberWhich key, counted from the end: 1 is the row itself, 2 its parent.
typeKeyword
optional
TEXT (or 0) to get the key as text, which is what you get when it is left out; INTEGER (or 1) to get a whole number. Any other value is an error.

Returns

Text or whole number. The key at that position from the end, or BLANK when the path has no key there.

Remarks

  • Position 1 is the last key of the path, the row's own; 2 is its parent, 3 the parent's parent. The path's length is the top.
  • A position before the top of the path, 0 or a negative one gives BLANK.
  • It gives what PATHITEM ( path, PATHLENGTH ( path ) + 1 - position ) gives.

Examples

The keys of a path, from the end

EVALUATE
ROW (
    "Itself", PATHITEMREVERSE ( "1|20|21", 1 ),
    "Parent", PATHITEMREVERSE ( "1|20|21", 2, INTEGER ),
    "Its parent", PATHITEMREVERSE ( "1|20|21", 3 ),
    "Beyond the top", PATHITEMREVERSE ( "1|20|21", 4 )
)
ItselfParentIts parentBeyond the top
21201(blank)

Each company's parent, by name

EVALUATE
SELECTCOLUMNS (
    Companies,
    "Company", Companies[Company],
    "Parent", LOOKUPVALUE (
        Companies[Company],
        Companies[Key], PATHITEMREVERSE ( PATH ( Companies[Key], Companies[Parent] ), 2, INTEGER )
    )
)
ORDER BY [Company]
CompanyParent
Alnabru depotDistribution
Bergen plantBrewing
BrewingExample Brewery Group
DistributionExample Brewery Group
Example Brewery Group(blank)
Example Brewery HoldingExample Brewery Group
Oslo plantBrewing
Trondheim plantBrewing

PATHITEM, PATH, PATHLENGTH, LOOKUPVALUE.

Last updated · OpenBI Studio 0.3.74