Create hierarchy columns with DAX

The purpose of this example is to create columns in the Account dimension which will support a six-level hierarchy.

  • The table is self-joined based on the AccountKey and ParentAccountKey parent account code
Account Dimension Parent-Child Hierarchy
  1. From the Data View, select the Account table and click on New Column from the Modeling tab.
  2. Create a DAX calculated column to return the account name of the top most parent for the given account row
Calculated Column for Account Hierarchy
  1. Create five additional calculated columns to support the additional levels of the hierarchy. 
    • In each calculation, revise the second parameter of the PATHITEM() function for the level of the hierarchy .
    • For example, the Account Level 3 column's PATHITEM() function should use (AccountPath,3,1).
Data View of Calculated Columns
Some rows will have blank values for a given column because it's higher in the structure. For example, the balance sheet account doesn't have values for the level 2 through 6 columns. The calculated columns will appear in the Fields list with formula icons.