Returns a string which contains a delimited list of IDs, starting with the top/root of a hierarchy and ending with the specified ID.
The column containing the IDs for each row.
The column containing the parent IDs for each row.
A delimited text string containing the identifiers of all the parents to the current identifier.
This function is used in tables that have some kind of internal hierarchy, to return the items that are related to the current row value. For example, in an Employees table that contains employees, the managers of employees, and the managers of the managers, you can return the path that connects an employee to his or her manager.
The path is not constrained to a single level of parent-child relationships; it can return related rows that are several levels up from the specified starting row.
- The delimiter used to separate the ascendants is the vertical bar, ‘|’.
- The values in ID_columnName and parent_columnName must have the same data type, text or integer.
- Values in parent_columnName must be present in ID_columnName. That is, you cannot look up a parent if there is no value at the child level.
- If parent_columnName is BLANK then PATH() returns ID_columnName value. In other words, if you look for the manager of an employee but the parent_columnName column has no data, the PATH function returns just the employee ID.
- If ID_columnName has duplicates and parent_columnName is the same for those duplicates then PATH() returns the common parent_columnName value; however, if parent_columnName value is different for those duplicates then PATH() returns an error. In other words, if you have two listings for the same employee ID and they have the same manager ID, the PATH function returns the ID for that manager. However, if there are two identical employee IDs that have different manager IDs, the PATH function returns an error.
- If ID_columnName is BLANK then PATH() returns BLANK.
- If ID_columnName contains a vertical bar ‘|’ then PATH() returns an error.
Learn more about PATH in the following articles:
DAX does not directly support parent-child hierarchies. To obtain a browsable hierarchy in the data model, you have to naturalize a parent-child hierarchy. DAX provides specific functions to naturalize a parent-child hierarchy using calculated columns. The complete pattern also includes measures that improve the visualization of ragged hierarchies in Power Pivot. » Read more
Other related functions are:
Contributors: Alberto Ferrari, Marco Russo
MSDN documentation: https://docs.microsoft.com/en-us/dax/path-function-dax