

You can navigate the resulting hierarchy in Excel as shown in Figure 6. Figure 5 The Hierarchy heading includes the calculated columns created to naturalize the hierarchy. You define the hierarchy in the diagram view of the data model shown in Figure 5.

= PATH ( Nodes, Nodes )įigure 4 The Path column contains the result of the PATH functionĮach column that defines a level in the hierarchy uses the PATHITEM function to retrieve the proper value for that level, as shown in Figure 3. The Path column in Figure 4 provides this content using the special PATH function. You can create these columns in DAX by leveraging a hidden calculated column that provides a string with the complete path to reach the node in the current row of the table. Power Pivot and Analysis Services hierarchies have an intrinsic limit of 64 levels.įigure 3 shows the resulting table with the naturalized hierarchy.įigure 3 The naturalized hierarchy has one column for each level of the hierarchy. Otherwise, you have to estimate it, because this number cannot change dynamically. To create the right number of calculated columns, you must know in advance the maximum depth of the hierarchy. Your goal is to create one calculated column for each level of the hierarchy. Figure 2 The hierarchy has two branches-one with two levels and one with three levels. You might represent relationships between nodes using a tree structure, where all nodes without a parent are roots of a hierarchy tree, as shown in Figure 2. The Parent column specifies the direct report of each agent, as you see in Figure 1.įigure 1 Values in the Parent column reference the Name column. Suppose you have an Agents table containing sales figures for each agent. The complete pattern also includes measures that improve the visualization of ragged hierarchies in Power Pivot. DAX provides specific functions to naturalize a parent-child hierarchy using calculated columns.

To obtain a browsable hierarchy in the data model, you have to naturalize a parent-child hierarchy. DAX does not directly support parent-child hierarchies.
