Create a Hierarchy with Directory

Select a Semantic Usage of Hierarchy with Directory to indicate that your entity contains one or more parent-child hierarchies and has an association to a directory dimension containing a list of the hierarchies.

These types of hierarchy entities can include nodes from multiple dimensions (for example, country, cost center group, and cost center) and are commonly imported from SAP S/4HANA Cloud and SAP BW (including SAP BW Bridge) systems.

For more information and walkthroughs, see also:

Example: SAP S/4HANA Cloud General Ledger Account Hierarchy

Our example is created from entities imported from an SAP S/4HANA Cloud system and defines hierarchies of general ledger accounts and categories:
  • I_GLACCOUNTLINEITEMRAWDATA (semantic usage: Fact) - Contains transactional data and has an association to:

    • I_GLAccountInChartOfAccounts (semantic usage: Dimension) - A dimension containing general ledger accounts, which are organized into hierarchies. It has associations to:

      • I_GLAccountText (semantic usage: Text) - A text entity containing translations of the general ledger account names.

      • I_GLAccountHierarchyNode (semantic usage: Hierarchy with Directory) - A hierarchy entity for defining parent-child relationships between general ledger accounts and categories. It has associations to:

        • I_GLAccountHierarchy (semantic usage: Dimension) - The directory for GLAccountHierarchyNode, which contains the names of the various hierarchies. It has an association to:

          • I_GLAccountHierarchyText (semantic usage: Text) - A text entity containing translations of the hierarchy names.

        • GLAccountGroups (semantic usage: Dimension) - A dimension containing grouping nodes that are used in the general ledger account hierarchies. It has an association to:

          • I_GLAccountGroupText (semantic usage: Text) - A text entity containing translations of the general ledger account group names.

Prepare the Data Node and Other Hierarchy Node Dimensions and Text Entities

You must identify a data node dimension, which is the dimension that contains the lowest nodes (data nodes) in the hierarchy, along with any other dimensions that contribute nodes to the hierarchy. Each dimension will generally be associated with one or more text entities to provide translation of the node names.

In our example, GLAccountInChartOfAccounts is the data node dimension and GLAccountGroups is another dimension providing non-data nodes, and each has an association to an appropriate text entity:
  1. Open your data node dimension and set the semantic usage to Dimension.

    Your data node dimension must have a key and will contain records of members that are related in one or more parent-child hierarchies.

    For more information about dimensions, see Create a Dimension to Categorize Data.

  2. In the Associations section, click Start of the navigation pathNew Next navigation step Hierarchy AssociationEnd of the navigation path, select your hierarchy entity and complete the mapping.

  3. In the Associations section, click Start of the navigation pathNew Next navigation step Text AssociationEnd of the navigation path, select the appropriate text entity and complete the mapping.

    For more information about text entities, see Create a Text Entity for Attribute Translation.

  4. [optional] If your hierarchy contains other node types, ensure that each dimension containing one of these node types is available in your space, has its semantic usage set to Dimension, and has text associations to appropriate text entities.

    In our example, GLAccountGroups is a dimension containing GL Account grouping nodes, which is a non-data node type in our hierarchy.

Prepare the Hierarchy Directory Entity and Text Entities

You must identify a hierarchy directory entity that contains hierarchy identifiers and names. A directory will generally be associated with one or more text entities to provide translation of the hierarchy names.

In our example, I_GLAccountHierarchy is the hierarchy directory dimension:
  1. Open your hierarchy directory entity and set the semantic usage to Dimension.

  2. Ensure that it contains, as a minimum, the following columns:

    • Hierarchy Identifier - (key) containing the unique identifier of a hierarchy

    • Hierarchy Name - Containing the human-readable name of a hierarchy.

      A text entity may be used to provide translations of the hierarchy name

    • [optional] Time dependency-columns to control the availability of hierarchies based on the key date used in the eventual chart (see Enable Time-Dependency for a Dimension or Text Entity).

  3. In the Associations section, click Start of the navigation pathNew Next navigation step Text AssociationEnd of the navigation path, select the appropriate text entity and complete the mapping.

    For more information about text entities, see Create a Text Entity for Attribute Translation.

Prepare the Hierarchy Entity

You must identify a hierarchy entity that contains parent-child hierarchy data, along with hierarchy identifiers, node types, and unique identifier columns for each type of node.

In our example I_GLAccountHierarchyNode is the hierarchy entity:
  1. Open the table or view containing the hierarchy information and set the Semantic Usage property to Hierarchy with Directory.

  2. Ensure the following columns are marked as keys:

    • The column containing the identifiers of child nodes in the parent-child relationship.

      In our example, this is the NodeID column.

    • The column containing the identifier of the hierarchy to which the parent-child relationship belongs.

      In our example, this is the HierarchyName column.

  3. Create an association from the hierarchy entity to the directory entity, and map the column you selected as the Hierarchy Name Column in the hierarchy entity to the primary key column in the directory entity.

    In our example, the HierarchyName column in the hierarchy entity I_GLAccountHierarchyNode, is mapped to the primary key column in the directory entity, I_GLAccountHierarchy.

  4. [if multiple types of hierarchy nodes are specified] Create an association from the hierarchy entity to each (non-data) dimension containing nodes that are used in the hierarchies, and map the appropriate node type values columns identified in the hierarchy entity to the key columns in the dimensions.

    In our example, the columns, GLAccountHierarchy and HierarchyNode in the hierarchy entity I_GLAccountHierarchyNode, are mapped to the key columns in the GLAccountGroups dimension.

  5. [optional] If time-dependency columns are available, add the appropriate semantic types (see Enable Time-Dependency for a Dimension or Text Entity).

  6. Click the Hierarchy with Directory Settings button, complete the following properties in the dialog, and then click OK:

    Property

    Description

    Parent

    Select the column containing the identifiers of parent nodes in the parent-child relationship.

    In our example, the ParentID column is selected.

    Child

    Select the column containing the identifiers of child nodes in the parent-child relationship.

    This column must be marked as a key.

    In our example, the NodeID column is selected.

    Hierarchy Directory Association

    Select the association pointing to the hierarchy directory entity.

    In our example, the To Hierarchy Directory association is selected.

    Hierarchy Directory Entity

    Displays the name of the hierarchy directory entity, based on the property above.

    Display Dimension Keys as Node Keys

    Select to display the dimension key values (which are often more informative than the hierarchy node keys), when drilling down into your hierarchy in an analytic model and in SAP Analytics Cloud.

    Node Type Column

    Select the column containing the type of the child node in the parent-child relationship.

    In our example, the NodeTypeField column is selected.

    Node Type Values

    Create one entry for each value that appears in the node type column, and complete the properties as follows:

    • Node Type Value - Enter the value that is used to identify the type of the node in the Node Type Column.

      In our example:
      • GLAccount is used to identify that the node is from the GLAccountInChartOfAccounts dimension.

      • HierarchyNode is used to identify that the node is from the GLAccountGroups dimension.

    • Set as Data Node - Select this option if this type of node is at the lowest level of the hierarchy.

      In our example, GLAccount is the data node type.

    • Column 1- Select the column that contains the identifiers of nodes of this type. If more than one column is used, click the Add Column button to add and specify each required column.

      All of the columns you identify must be mapped in the association between the hierarchy and the dimension.

      In our example:
      • Two columns, ChartOfAccounts and GLAccount identify nodes from the GLAccountInChartOfAccounts dimension.

      • Two columns, GLAccountHierarchy and HierarchyNode identify nodes from the GLAccountGroups dimension.

Use a Hierarchy in an Analytic Model

If your data dimension is included in an analytic model, you can enable any of your defined hierarchies in the analytic preview:
  1. Open your analytic model and click Preview to open the analytic preview.

  2. In the Available Objects panel, enable your data node column as a row.

    No hierarchy is enabled by default.

  3. In the Builder panel Rows section, hover over your data node column and then click Start of the navigation pathMore Next navigation step Hierarchy Next navigation step Select HierarchyEnd of the navigation path.

  4. In the Select Hierarchy dialog, select your hierarchy and click OK

    The hierarchy is shown collapsed and you can drill down into it as appropriate.

For more information about working with the analytic preview, see Preview Data in an Analytic Model.

Use a Hierarchy in an SAP Analytics Cloud Story

Hierarchies defined in a hierarchy with directory are supported only in stories created using the Optimized Design Experience (see Create a New Story (Optimized Story Experience) in the SAP Analytics Cloud documentation.

For information about using hierarchies in SAP Analytics Cloud, see Work with Hierarchies in a Chart.