Use Hierarchies to Aggregate and Apportion Values

You will often want to organise information in a hierarchy. The hierarchy represents an entire collection of information. You can view the hierarchy at any level that is convenient. In effect, each level summarises the levels below it. Therefore, you may want any numerical information at the bottom of the hierarchy to be totalled at each higher level. So, it is common to use hierarchies to aggregate and apportion values.

Cradle can help you by calculating appropriate values at each level in the hierarchy. In the following System Breakdown Structure (SBS) hierarchy, the total weight of that component and everything within it is shown inside the square brackets:

Use Hierarchies to Aggregate and Apportion Values
SBS Hierarchy With Aggregated Total Weights

Aggregation and Apportionment

Aggregation means to add together. In the example, the components of the transformer are:

  • Transformer, weight 15
  • Transformer mount, weight 5

Therefore, the aggregate weight is 20, which is shown as the weight of the entire transformer.

Apportion means to divide, or split. If a set of pumps is to weigh at most 200kg, and there are 4 pumps, then we can apportion this weight budget equally between the four pumps. So, each pump is to weigh 200kg divided by 4, which is 50kg for each pump.

So we normally aggregate actual values up a hierarchy.

Therefore we normally apportion a budget value down a hierarchy.

Use Hierarchies to Aggregate and Apportion Values

You can aggregate values up a hierarchy by:

  • Create an integer attribute that stores the value for each item
  • Create a calculation that adds the item’s value and the total of the values of all its children
  • Store this calculated value as the total for this item and its children

Another way to say this is:

  • value for an item = user-supplied value
  • total for an item = value for the item + total of the ‘total for an item’ for all children

You can apportion values down a hierarchy in a similar way:

  • Create an integer value that stores the budget value for the item
  • Create a calculation that divides the item’s parent budget value
  • Store the calculated value as the budget for this item

Integer Attributes

You can create integer, or positive integer, attributes in items. An integer attribute can only store an integer value. You can only store integers greater than or equal to zero in a positive integer attribute.

You can create integer attributes as categories and then assign them to your items. For example, you can create an integer attribute Weight by:

Use Hierarchies to Aggregate and Apportion Values
Creating an Integer Attribute
  1. Ensure you are logged-in as a user who has PROJECT privilege so you can change the schema
  2. Select Project Setup from the Project tab
  3. Set Options to Item Definitions and select the Categories tab:
  4. Select New… and enter the name of the new attribute, for example Weight, and set its type to be Integer or Positive Integer:

Assign the new Weight category to an item type by:

Use Hierarchies to Aggregate and Apportion Values
Assign an Integer Attribute to an Item Type
  1. Select the Item Definitions tab
  2. Choose the item type
  3. Select Categories
  4. Select an unused category assignment and select the new Weight category:

Repeat this process to create another positive integer attribute Total Weight and also assign it to the item type. This is the attribute that will receive the result of the aggregation calculation.

The Aggregation Calculation

The last step to use hierarchies to aggregate and apportion values is the aggregation or apportionment calculation.

Still inside the schema and with the same item type selected:

Use Hierarchies to Aggregate and Apportion Values
A New Calculation
  • Select Calculations…
  • Select New and enter the calulation‘s name, such as Weight Calcs
  • To define the expression, we start by choosing the item’s own weight category:
Use Hierarchies to Aggregate and Apportion Values
Add a Category to a Calculation
  • Then click the + button or manually enter + into the calculation to perform an addition
Use Hierarchies to Aggregate and Apportion Values
Add Linked Items Into a Calculation
  • Then choose to total the Total Weight of all child items. We find the child items by finding all items of the same type that are linked to the current item by following all cross references found by the navigation Downwards. When we find these linked items, we get the Total Weight value from them:
  • Select Validate to check the expression that we have created
Use Hierarchies to Aggregate and Apportion Values
Store the Calculation in an Attribute
  • Finally we specify that we want the result of the calculation to be stored in the integer category Total Weight that we calculated. This means that each item’s total weight will be available to its parent item when it get values from its children, see 2 above

Using the Results

We can use hierarchies to aggregate and apportion values and the results can be used either directly from the calculation, or by saving the result of the calculation in an attribute.

You can either display a calculation or the category that stores its result. The values can be shown in views. This is what what we did to produce the SBS display at the start of this blog entry. Here is the view:

Use Hierarchies to Aggregate and Apportion Values
Displaying a Calculation in a View

You can use a calculation, or the category that stores its result:

  • In other calculations, or
  • As part of rule sets, or
  • To calculate part of a metric, or
  • To calculate KPIs (key performance indicators) in dashboards