Unbalanced Hierarchies
An Unbalanced Hierarchy is a new special type of Entity which supports defining parent-child relations between its members. In an Unbalanced Hierarchy, data is aggregated on the fly along the hierarchy. These structures are typically used in financial reporting or in organization structures and are common to many other business models.
Example of an unbalanced hierarchy:
All items are members of the same entity. Each item may have multiple children but one parent only. Items that don't have any children below are called leaves and can store data. Items that don't have parents are called roots.
This new type of Entity is similar to the Roll-up Entity, but without the requirement that member's code need to be hierarchical along the roll-up. Roll-up entities continue to be supported for back-compatibility but Unbalanced Hierarchies Entities are more powerful than Roll-up entities. It is therefore recommended to use Unbalanced Hierarchies.
Enabling Unbalanced Hierarchies
To enable an Unbalanced Hierarchy, go to Entities, select an entity and check the "Unbalanced hierarchy" checkbox.
This flag is available to any entity regardless of its existing relationships within one or more trees. Unbalanced Hierarchies are not available in custom time-entities.
Creating the parent-child relationship
When the Unbalanced Hierarchy functionality is enabled, the target entity will always contain all members of the hierarchy itself, regardless of whether they are parent elements or child elements.
To create a complete Unbalanced hierarchy you'll need two separate data readers:
- One to import all members of the hierarchy into the selected entity
- A different data reader to assign each member its parent entity
Members with no parent entity will be considered root entities, i.e. entities at the most aggregate level.
To configure the data reader that will structure parent-child relationships, head to the Data reader section and build a new Data reader. In the mapping table, the entity that contains the unbalanced hierarchy will show an additional “parent” field for its members, in addition to the usual “code” and “description” fields.
You will need to map the child code to the code field and the parent code to the parent field.
Alternatively, you can manually define parent members from the relationships section of the Data model: to do this, you will need to view the relationship between the entity and itself.
To establish the parent-child relationship, click on a member and select which other member of the hierarchy will be the parent in the tree.
In order to load an Unbalanced Hierarchy from an external table or file, first load all parents and children items in the entity through a Data Reader (or manually), then read the parent-child table or file that contains the relations.
In addition to defining the parent-child relationship, from this interface you will also be able to review the hierarchy as a tree structure.
Now the unbalanced entity is ready to be used to aggregate data according to the defined hierarchy and to make specific selections.
Now, let’s consider a cube that has, between its dimensions, at least one entity that contains an unbalanced hierarchy.
The cube will contain data coming only from the leaves of the tree diagram. Any data not coming from the leaf elements will be ignored when aggregating data through Unbalanced Hierarchies.
By executing a layout to this cube, data will be aggregated following the same logic.
This aggregation logic will be applied in the following cases:
- The entity that contains the unbalanced hierarchy is the most nested one in the layout (i.e. in the rightmost position in the "BY ROW" field)
- A selection on the unbalanced entity is executed and the unbalanced entity is not in the layout axes
The aggregation logic mentioned above won’t be applied in the following cases:
- A “refer to” condition is applied on a parent member of the unbalanced hierarchy within the entity
- The entity that contains the unbalanced hierarchy is in the “by column” field in the layout
- The entity that contains the unbalanced hierarchy is not the most nested one in the layout (i.e. it is not in the rightmost position in the "BY ROW" field)
- The data block aggregation has been disabled by ticking the “Disable unbalanced hierarchy” checkbox under the “RULES” menu in the block settings panel
- The layout is used in a Dataflow
Entity in the “BY ROW” field
Once the entity that contains the unbalanced hierarchy is added in the “BY ROW” field in a Layout, values are aggregated on-the-fly along the roll-up hierarchy.
The items displayed in the Layout are those selected in the Select filters. Note that the on-the-fly aggregation is not affected by the Select filters therefore the values of parent items don't vary if you Select or Exclude one or more children. The Select filters only affect which rows are returned by the Layout.
For example, let’s consider a hierarchy made up of three members:
In this scenario, Margin is parent of both Cost and Sales.
The physically saved data within the cube are the following:
- Cost -100
- Sales +1000
The corresponding Data View will show the following values:
By selecting Margin and Cost only, the Data View will show the following values:
When the entity that contains the unbalanced hierarchy is added in the “BY ROW” field in a layout, it is also possible to apply Rules and Nexel formulas to it.
Entity in a Select
Suppose the entity that contains the unbalanced hierarchy is not in the “BY ROW” field in a layout, but you've selected a parent using a Select: the layout will show the total sum of that parent’s children values.
In the previous example, by selecting Margin, the Data View will show the total sum of 900.
Drill-down
When an entity contains an unbalanced hierarchy, you can drill-down to the next level down the hierarchy by drilling-down on the entity itself. This process can be repeated down to the deepest level of the hierarchy, the leaf level.
Select
In the selection window, the entity that contains the unbalanced hierarchy will be shown as a tree diagram.
Click on the small arrow next to a node to expand it, then tick the checkbox next to the entity member that you want to add to the selection.
The search function in the upper right corner of the window will display the searched member and all parent-child relationships involving it.
There are also special Select options that can be used on a single entity member of an unbalanced hierarchy:
- Descendants
- Children
- Leaves
- Ancestors
- Parent
- Siblings
These selections are dynamic: any modification to an unbalanced hierarchy will be reflected in all affected Selects.
For example, if the number of children of a particular member changes and a Select includes those children, the Select will self-update automatically to include or exclude members accordingly.
All these features are also available in the vertical and pop-up selector. They can also be used in Layout Selects, Procedures Select, Screen Selects and Security Selects.
Descendants
This option selects all descendants (children) of the selected member.
The value next to the option defines the depth of the selection:
- ALL: All descendants on any level will be selected
- 1: All descendants that are 1 level away from the selected member will be selected
- 2: All descendants that are 2 levels away from the selected member will be selected
And so on…
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
The “Hierarchy” checkbox defines whether or not to include the levels between the selected member and the member at the maximum depth of the selection.
Children
This option selects direct descendants (children) of the selected member. Descendants of the selected member’s descendants won’t be selected.
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
Leaves
This option selects leaf members that are descendants of the selected member. Nodes are excluded from the selection.
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
Ancestors
This option selects all parent members of the selected member, up to the root member.
The value next to the option defines the depth of the selection:
- ALL: All ancestors on any level will be selected
- 1: All ancestors that are 1 level above the selected member will be selected
- 2: All ancestors that are 2 levels above the selected member will be selected
And so on…
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
The “Hierarchy” checkbox defines whether or not to include the levels between the selected member and the root member.
Parent
This option selects the direct parent member of the selected member.
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
Siblings
This option selects all siblings of the selected member.
The “Inclusive” checkbox defines whether or not to include the selected member in the selection.
Sorting Unbalanced hierarchies
Row sorting follows the tree structure of the hierarchy, so members will not be sorted by code or description, but they will always be displayed as a tree diagram. When sharing the same parent, members will be sorted according to the option chosen in the Entity's “Sort By” field.
Layout sorting options can be used to change the sort order on the individual layout.
Data Entry
When the Entity that contains an unbalanced hierarchy is added in the “BY ROW” field, you will be able to perform Data Entry on parent members: data will be proportionally distributed on children members following the split and splat logic, while a Data Entry on a leaf will be aggregated before saving it and then sent to the Data Model to update it.
Only leaf data are saved.
When cells are locked, the following rules apply:
- If the locked cell is a descendant of the cell on which the Data Entry is performed, it will be ignored when redistributing data and its value will be retained
- if the locked cell is an ancestor of the cell on which the Data Entry is performed, its value will be retained and data will be redistributed among all its other descendants
Entity in a Tree
When the Entity that contains an unbalanced hierarchy is added in the “BY ROW” field of a Tree Layout and is the most nested one, the Tree will reflect the unbalanced hierarchy.