# Unit Analysis

## Overview

The Calculation page analyses the Unit of your Calculation as you are creating it. This helps you check your Calculation for logical consistency, and provides clues to the Unit of Variables required to finish your Calculation.

The Calculation page shows two or three items:

<table data-header-hidden><thead><tr><th width="244">Unit analysis item</th><th>Details</th></tr></thead><tbody><tr><td><strong>Target Unit</strong></td><td>The Unit of the Variable in which we are creating the Calculation.<br><br><em>Note: If you haven't defined a Unit for the Variable, this will be guessed based on context</em></td></tr><tr><td><strong>Current Unit</strong></td><td>The Unit currently produced by the Calculation.<br><br>This item will show warning messages if a Unit cannot be determined.</td></tr><tr><td><strong>Remaining Unit</strong></td><td>The Unit required to finish the Calculation with the Target Unit.<br><br>The remaining Unit will only be shown if the entered formula is empty ends in an operator (<code>+</code>, <code>-</code>, <code>/</code>, <code>*</code>).</td></tr></tbody></table>

## Worked Example

In this example, we are creating a Variable called `Gym Revenues`, which is equal to `Gym members * Revenue per member`.

`Gym Revenues` has a Unit of `GBP`.

### Step 1

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FHLQ2WnyixuZTZ8MWvagT%2Fimage.png?alt=media&#x26;token=a42ac73c-e10b-41ec-9d2a-f5758e24fbac" alt=""><figcaption><p>Step 1</p></figcaption></figure>

To begin with we have an empty formula. **Target Unit** shows our desired Unit (`GBP`). **Current Unit** shows that the Calculation is not currently valid. **Remaining Unit** shows that if we reference a Variable with Unit `GBP` we will have the correct Unit.

### Step 2

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FqXwEilO7OdrjOQnVm1pf%2Fimage.png?alt=media&#x26;token=b540dedc-3dbb-4897-8fbc-fb3ae6ad3b24" alt=""><figcaption><p>Step 2</p></figcaption></figure>

We enter a reference to `Gym Members`. This updates the **Current Unit** to `Member`, and alerts us that `Member` does not match the **Target Unit** of `GBP`. We have not entered an operator, so Models cannot determine the **Remaining Unit**.

### Step 3

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F4MhBLdlOWO6mb7Dx4cdI%2Fimage.png?alt=media&#x26;token=fa0078aa-e585-4983-843c-acf6e6c0f351" alt=""><figcaption><p>Step 3</p></figcaption></figure>

We enter a `*` (multiply) operator. Models can now work out that we need to reference a Variable with Unit `GBP / Member` in order to arrive at the Target Unit, as **Current Unit** \* **Remaining Unit** = **Target Unit**.

At this point, if we click on the **Add Variable Reference** ![](https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FQdWH8BhVdevVv4g8aKN5%2Fimage.png?alt=media\&token=f04fcfc6-03dd-46a4-8003-2624e2606c8e) button in the  Calculation Part list, we will be shown only Variables that match the Remaining Unit of `GBP / Member`.

### Step 4

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F60M1yhBOzPtaHS9BHEHT%2Fimage.png?alt=media&#x26;token=089b9966-90e9-436f-ba99-a1c27aea5305" alt=""><figcaption><p>Step 4</p></figcaption></figure>

We add a reference to the `Revenue per member` Variable, which has Unit `GBP / Member`.

The **Current Unit** now matches the **Target Unit**.
