Designing and Creating Hierarchies

Objective

After completing this lesson, you will be able to create a dimension and hierarchy.

Hierarchies

Hierarchies let you structure your data. You can create hierarchies during the data preparation stage, or within the modeler after you’ve created a model. While creating hierarchies during the data preparation stage instead of in the modeler is faster and more automated, any subsequent adjustments or changes need to be made in the modeler.

Types of Hierarchies

Two types of hierarchy are available:

  1. Level-based hierarchy: A level-based hierarchy organizes the members of a dimension into levels, such as Country, State, and City.
  2. Parent-child hierarchy: A parent-child hierarchy organizes the members of a dimension into a set of parent-child relationships.

In this lesson, we use a simplified example of geographical data for city, state, and country to show you the difference between the two hierarchy types.

Level-Based Hierarchy

You can add level-based hierarchies to generic dimensions and organization dimensions. A level-based hierarchy organizes the members of a dimension into levels, such as Country, State, and City. In this example, a hierarchy allows you to organize these geographic areas into logical levels (also called nodes), from the largest area to the most granular.

The following example shows the Stores dimension with four properties. When you create a level-based hierarchy, you drag and drop the properties into the hierarchy in the Hierarchy Builder. In the table widget on the right, you can see the cities have been organized into the appropriate state.

Add a level-based hierarchy from dimension settings

The following video, we explore a second way to create a level-based hierarchy by combining individual dimensions to create one dimension with multiple properties.

Parent-Child Hierarchy

A parent-child hierarchy organizes the members of a dimension into a set of parent-child relationships.

The following example shows the Stores dimension, but this time with a list of members. In the dimension table on the right, you can see the cities have been organized into the appropriate state, which are all part of the country.

Dimension member IDs with a hierarchy column and a hierarchical display

You create a parent-child hierarchy from the dimension table, starting the same was as a level-based hierarchy. In the example, you can see:

  1. A dimension with members including Country, State, and City.
  2. When you add a parent-child hierarchy, a new column is inserted into the grid. Once the parent-child hierarchy is created, select it to create the structure.
  3. In Hierarchy Maintenance, drag and drop members to the build the parent-child relationships visually.
  4. If more than one hierarchy has been defined, you can select which one to work with from the dropdown list.
  5. The parent-child hierarchy appears in the newly created column. You can also update the hierarchy from the dimension table by manually inserting the members.

Parent-child hierarchies can be maintained manually in SAP Analytics Cloud or imported from files or SAP systems.

Note

When working with parent-child hierarchies for a planning model, avoid situations where data can be booked directly to a parent node.

These situations include the following:

  1. Structuring two or more hierarchies so that a member is a leaf node in one hierarchy and a parent node in a different hierarchy.
  2. Updating a hierarchy so that a leaf node that has a value booked to it is changed to a parent node.

Additional Information

Now that we covered level-based and parent-child hierarchies, there are a few other points to consider:

  • You can set or change the default hierarchy for any type of dimension, for both level-based and parent child-hierarchies, in the hierarchy builder.
  • In a standard model, multiple account hierarchies are allowed, but an account model, the Account dimension type has only one system-generated parent-child hierarchy.
  • Dimension types that allow multiple hierarchies can have either one or more level-based hierarchies or one or more parent-child hierarchies, but not a combination of both.
  • Types of dimensions that don't support custom hierarchies:
    • For the Date dimension type, hierarchies are predefined based on the model granularity, and whether you have enabled fiscal time for the model. You can specify a default hierarchy in the settings for the date dimension. In a standard model, additional custom hierarchies may be added. We will cover custom time hierarchies in more detail later in the course.
    • The Version dimension type does not have a hierarchy, because different versions are independent from one another and do not have parent-child relationships.

You can find more information on hierarchies, including managing hierarchies and various hierarchy scenarios in the About Hierarchies section of the SAP Help Portal.

Types of Hierarchies

Two types of hierarchy are available:

  1. Level-based hierarchy: A level-based hierarchy organizes multiple dimensions or properties into levels, such as country, state, and city.
  2. Parent-child hierarchy: A parent-child hierarchy organizes the members of a single dimension into a set of parent-child relationships.

Level-based Hierarchy

The following example shows dimensions with a level-based hierarchy.

Add a level-based hierarchy from dimension settings

Parent-child Hierarchy

The following example shows dimensions with a parent-child hierarchy.

Dimension member IDs with a hierarchy column and a hierarchical display

Parent-child hierarchies can be maintained manually in SAP Analytics Cloud or imported from files or SAP systems.

Note

When working with parent-child hierarchies for a planning model, avoid situations where data can be booked directly to a parent node.

These situations include the following:

  • Structuring two or more hierarchies so that a member is a leaf node in one hierarchy and a parent node in a different hierarchy.
  • Updating a hierarchy so that a leaf node that has a value booked to it is changed to a parent node.

Watch this video to learn how to create a level-based hierarchy.

Create the Stores Dimension, Hierarchy, and Properties

Business Example: You are creating a model for your team and you need to create a public dimension (as it will be used in multiple models) with a level-based hierarchy and custom properties. There is also a requirement to perform roll-ups and report by property values.

Task Flow: In this practice exercise, you will:

  • Create a public dimension.
  • Add properties to the dimension.
  • Use the hierarchy builder to add hierarchies to the dimension.