---
title: "How to: Create Hierarchies From Attributes in IBM Planning Analytics."
description: "[Hierarchies](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/what-is-a-hierarchy-in-ibm-planning-analytics/) are a great way to improve analysis in [IBM Planning Analytics](https://www.aramar.co.uk/ibm-planning-analytics/) without adding additional dimensions to your [cubes.](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/how-to-create-a-cube-in-ibm-planning-analytics/) For example, your products may already roll up by product type, but you may also want to analyse those same products…"
url: "https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/how-to-create-hierarchies-from-attributes/"
updated: "2026-06-23"
category: IBM Planning Analytics
---

# How to: Create Hierarchies From Attributes in IBM Planning Analytics.

[Hierarchies](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/what-is-a-hierarchy-in-ibm-planning-analytics/) are a great way to improve analysis in [IBM Planning Analytics](https://www.aramar.co.uk/ibm-planning-analytics/) without adding additional dimensions to your [cubes.](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/how-to-create-a-cube-in-ibm-planning-analytics/)

For example, your products may already roll up by product type, but you may also want to analyse those same products by manufacturing country, supplier or brand. Instead of manually maintaining multiple consolidation structures, you can automatically generate hierarchies using attributes that already exist within your [dimension.](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/fundamentals-what-are-dimensions-in-ibm-planning-analytics/)

This is especially useful when dimensions are regularly updated from an ERP or source system, where manually maintaining hierarchies would quickly become time-consuming.

## Creating Hierarchy’s using the “Create Hierarchy” shortcut .

In [Planning Analytics Workspace,](https://www.aramar.co.uk/whats-new-in-ibm-planning-analytics-workspace-paw/) there is a simple “Create Hierarchy” option available within the dimension editor by right clicking on the Dimension and selecting “Create Hierarchy”.

This automatically generates a basic hierarchy from an attribute.

![create hierarchy in planning analytics](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.12.34-1024x407.png)

The good news is that the same result can be achieved very easily using a [TurboIntegrator (TI) process.](https://www.aramar.co.uk/knowledge-share/ibm-planning-analytics/how-to-create-a-turbo-integrator-ti-process-in-ibm-planning-analytics/)

The advantage of building your own process is that you gain far more control over how the hierarchy is created and maintained.

## What this process will do

This process will:

- read a text attribute from a dimension
- create a new hierarchy
- automatically generate consolidations from the attribute values
- assign the leaf-level elements underneath them

### Step 1 — Create a new TI process

Create a new TurboIntegrator process with no data source.

We are only using the process to build metadata, so no source file or cube is required.

The process will use three parameters:

- Dimension Name
- Attribute Name
- Hierarchy Name

![create hierachy parameters planning analytics](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.15.22-1024x236.png)

### Step 2 — Add the Prolog code

All of the logic sits within the Prolog tab of the process.

The script:

- checks the dimension exists
- creates or clears the hierarchy
- loops through the dimension elements
- reads the attribute values
- builds the hierarchy structure automatically

Paste the following code into the Prolog section:

*# Check if the dimension exists, if it returns 0 it does not, then quit the process*

*if (DimensionExists( pDimension )= 0);*

*ProcessQuit;*

*endif;*

*# Set the name of the cube that stores the attributes for the dimension.*

*vAttributeCubeName = '}ElementAttributes_' | pDimension ;*

*# Does the hierarchy exist in the dimension?*

*if (HierarchyExists( pDimension, pHierarchy )= 0);*

*HierarchyCreate( pDimension, pHierarchy );*

*else;*

*HierarchyDeleteAllElements( pDimension, pHierarchy );*

*endif;*

*# Set hierarchy sort order*

*HierarchySortOrder( pDimension, pHierarchy, 'By Name', 'Ascending', 'By Name', 'Ascending' );*

*# Create top level element*

*HierarchyElementInsertDirect( pDimension, pHierarchy, '', 'All ' | pHierarchy,'C' );*

*# Count elements*

*vDimensionElementCount = DIMSIZ( pDimension );*

*vCount = 1 ;*

*# Loop through dimension*

*while (vCount <= vDimensionElementCount);*

*vElementName = DIMNM( pDimension, vCount );*

*vAttributeValue = 'No Value' ;*

*# Check leaf level*

*if (ElementLevel( pDimension, pDimension, vElementName )= 0);*

*# Check attribute has a value*

*if (CellGetS( vAttributeCubeName , vElementName, pAttribute) @<> '');*

*vAttributeValue = CellGetS( vAttributeCubeName, vElementName , pAttribute );*

*# Create consolidation if required*

*if (HierarchyElementExists ( pDimension, pHierarchy, vAttributeValue ) = 0);*

*HierarchyElementInsertDirect ( pDimension, pHierarchy, '', vAttributeValue, 'C' );*

*HierarchyElementComponentAddDirect(*

*pDimension,*

*pHierarchy,*

*'All ' | pHierarchy,*

*vAttributeValue,*

*1.000000*

*);*

*endif;*

*# Add leaf element*

*HierarchyElementComponentAddDirect(*

*pDimension,*

*pHierarchy,*

*vAttributeValue,*

*vElementName,*

*1.000000*

*);*

*endif;*

*endif;*

*vCount = vCount + 1 ;*

*end;*

### Step 3 — Run the process

When the process runs, you will be prompted to enter:

- the dimension name
- the attribute name
- the new hierarchy name

The following was entered as an example into the prompts:

- Dimension: x.reg and fleet number
- Attribute: Comp vehicle
- Hierarchy: Company Car

![parameter - create hierarchy](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.22.11-1024x321.png)

Click on **‘Run’** to Run the process, the process will complete when the ‘Process .. executed successfully’ message appears, as below:

![process 'create hierarchy' executed successfully](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.23.11.png)

### Step 4 — Review the new hierarchy

Once the process has completed, the new hierarchy, ‘Company Car’, will appear within the dimension.

![hierachy company car successfully visibile in the databases](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.24.08-350x469.png)

The hierarchy structure will be built automatically from the attribute values.

![hierarchy structure](https://www.aramar.co.uk/wp-content/uploads/2026/06/Screenshot-2026-06-22-at-14.25.02-1024x515.png)

This allows users to analyse the same products in multiple ways without changing the cube structure.

For example, users could now analyse:

- products by product type
- products by manufacturing country
- products by supplier

All using the same underlying Product dimension.

## Things to be aware of.

This process only includes leaf-level elements. Consolidated elements are ignored because Planning Analytics does not allow a consolidated element to become a child within another hierarchy structure.

Elements with blank attributes are also ignored. In many models this is perfectly acceptable, but you could extend the process to place blank values into an “Other” or “Unassigned” consolidation if required.

Because the hierarchy is generated automatically, it can easily be rebuilt whenever new products or attribute values are added from the source system.

## Final thought

Automatically generating hierarchies from attributes can save a significant amount of manual maintenance within IBM Planning Analytics, especially in models where dimensions are regularly updated from external systems.

It also gives users much more flexibility when analysing data, without adding unnecessary complexity to cube design.

If you would like help building automated hierarchies, improving metadata processes or reviewing your Planning Analytics model structure, feel free to [talk to us. ](https://www.aramar.co.uk/contact/)
