> For the complete documentation index, see [llms.txt](https://help.taglo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.taglo.io/aggregation/creating-aggregations.md).

# Creating Aggregations

## Aggregation in the Variable wizard

Aggregations are created in the [**Variable wizard**](/variables/variable-basics/variable-setup.md).

<figure><img src="/files/O8yaI92k7ssMoX0YNAQ6" alt="Screenshots of the Variable wizard, showing how to create an Aggregation"><figcaption><p>Creating an Aggregation in the Variable dialog</p></figcaption></figure>

To create an Aggregation you will need to perform the following steps, as per the screenshots above:

* Select the `Aggregation` **Variable type** <mark style="color:green;">**(1)**</mark>
* Assign at least one [**Dimension**](/dimensions/introduction-to-dimensions.md) to the Variable <mark style="color:green;">**(2)**</mark>
* Set the [**Unit**](/units/introduction-to-units.md) for the Variable, in the **Unit step**
* In the **Aggregated Variables step**, select the Variables to be aggregated <mark style="color:green;">**(3)**</mark>. The **Item Statuses** table <mark style="color:green;">**(4)**</mark> shows which items have been selected, and can be used to filter the Variable list to matching items.

{% hint style="warning" %}
Selected Variables must have the correct Unit so that Models can match them correctly to the target items. The below section explains several ways to set up these Variables.
{% endhint %}

## Creating Variables with the correct Unit for Aggregation

Each aggregated Variable must have a Unit which has been modified to match one of the child items of the Aggregation Variable.

For instance, in the above example, the Aggregation Variable (`All costs by cost type`) has a Unit of `GDP` and a Dimension of `Cost type`, which has seven children (`Central staff`, `Gym staff`, etc.).

To match a `Central staff` Variable, we need a Variable with a Unit of `GDP` which has had a `Central staff` modifier applied. To match a `Gym staff` Variable, we need a Variable with a Unit of `GDP` which has had a `Gym staff` modifier applied, and so on for each item.

The screenshot below shows such Units for the `Central staff` and `Gym staff` items.

<figure><img src="/files/qd6YJjAUdNocsXPqWl8S" alt=""><figcaption><p>Variables with modified Units for Aggregation</p></figcaption></figure>

### Manual creation

These Variables can be created manually. In this case, the Unit should be specified with appropriate modifiers added, in the **Unit step** of the Variable wizard, as demonstrated in the gif below.

<figure><img src="/files/PoLAz5b3RCqkYeFEGGRc" alt="GIF showing the user setting a context modifier on a unit part in the Unit page of the Variables wizard"><figcaption><p>Setting a Unit Modifier</p></figcaption></figure>

Read [**here**](/units/key-unit-concepts.md#context) to understand more about Unit Modifiers.

### Automatic creation

If you have not already created the Variables to be aggregated, you can automatically create them in the [**Aggregated Variables step**](#aggregation-in-the-variable-dialog) of the Variable dialog.

To do so, perform the following steps, shown in the example screenshots below:

* Navigate to the **Aggregated Variables step**
* Select any items that you want to create in the **Item statuses** <mark style="color:green;">**(1)**</mark>. By default, all items will be selected. Selected items are indicated by the filter <img src="/files/cpuWBW9ex7lpdS5ZGWXb" alt="" data-size="line"> icon.
* Press the **Create selected** button <mark style="color:green;">**(2)**</mark>
* A Variable for each item will be automatically created, each with a correctly modified Unit <mark style="color:green;">**(3)**</mark>
* These new Variables should then be selected and edited as desired

<figure><img src="/files/E1N0Ilas4BEg1B8O4PDn" alt=""><figcaption><p>Example of automatic aggregated Variable creation</p></figcaption></figure>

### Aggregating Variables with Dimensions

You can aggregate Variables which themselves have Dimensions, if some or all of the child items of their Dimension are present in the Aggregation Variable.&#x20;

The screenshot below shows an example of this feature. In this case, the `All costs by cost type` Variable references a Variable <mark style="color:green;">**(1)**</mark> called `Costs: Recurring`, which has the `Simple recurring cost type` Dimension applied.&#x20;

The `Simple recurring cost type` Dimension has four cost items as children: `Marketing cost`, `Rent`, `Equipment`, and `IT & Technology` <mark style="color:green;">**(2)**</mark>. Each of these four items are also present in the `Cost type` Dimension that is applied to `All costs by cost type`. Hence selecting `Costs: Recurring` means that Models is able to determine values for those four items, as indicated in the **Item statuses control&#x20;**<mark style="color:green;">**(3)**</mark>.

{% hint style="info" %}
In this case, you do not need to apply any Modifiers to the Unit of `Costs: Recurring.`&#x20;

`Costs: Recurring` already has Unit `GBP`, and the relevant Modifiers are applied in the background by the `Simple recurring cost type` Dimension
{% endhint %}

<figure><img src="/files/k35xWPEIBr0xBxbBY6fC" alt=""><figcaption><p>Example of an Aggregation referencing a Variable with a Dimension</p></figcaption></figure>
