# Unit Factors

## Overview

It is common for models to change between different "sizes" of unit.

> For instance, a financial model for a large company may have a "standard monetary unit" of $000. This means that, unless otherwise specified, all monetary figures are in thousands of US dollars.
>
> Some Variables may need to be specified in a different unit, e.g. the price of a product may be in single US dollars ($).

Unit Factors in Models allows you to move between different factors within the same Model, without needing to specify different versions of the same Unit.

## Defining Unit Factors

Factors are applied to individual Unit Parts. When a Factor has been applied, it will be shown in brackets alongside the unit type, for example `GBP (000)` as shown in the screenshots below.

To edit the Factor, click on the Unit within the Unit Part <mark style="color:green;">**(1)**</mark>, which will bring up a Unit editor popup, within which you should click the "More" button <mark style="color:green;">**(2)**</mark>. This will open a new wizard step in which you can edit both the base Tag of the Unit Part and the Unit Factor <mark style="color:green;">**(3)**</mark>.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FDmxoO5HD1cJuLAWe96vr%2Fimage.png?alt=media&#x26;token=fdd97602-9017-463a-8c59-50e9f0425ccd" alt="Screenshot showing the Unit step of a Variable dialog, in which the Unit is currently set to GBP."><figcaption><p>Shortcut to bring up the Unit editor</p></figcaption></figure>

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F7HGSlevxZXvGe5b7PpPP%2Fimage.png?alt=media&#x26;token=27951897-2fd6-4555-9001-af31224ba42f" alt="Screenshot showing the open Unit editor popup, with the &#x22;More&#x22; button highlighted"><figcaption><p>The "More" button of the Unit editor</p></figcaption></figure>

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F04EZrFkVW0N7kBTXFOBV%2Fimage.png?alt=media&#x26;token=83b14cb0-864e-46a8-bd98-923ea9891c20" alt="Screenshot showing a Unit Part editing dialog, with the Unit Factor dropdown highlighted."><figcaption><p>Choosing a Unit Factor</p></figcaption></figure>

## Moving between Unit Factors in Calculations

Factors will be assessed by Models when analysing whether [**Calculations**](https://help.taglo.io/calculations) are consistent.

Models will show warnings if:

1. A Calculation produces a factor that is different from that of the specified Unit
2. You try to sum together items with different factors

These warnings, and their remedies, are described in the following sections.

### Factor matching error

The screenshots below show an example of how Models deals with a change in Unit Factors. In this case, we have a Variable, `Total revenues` of Unit `GBP`. A second Variable, `Total Revenues (000s)` <mark style="color:green;">**(1)**</mark>, has a Calculation that simply references the first Variable, but its Unit is in `GBP (000s)`.&#x20;

Models detects that the Calculation Unit (`GBP`) does not match the target Unit of `GBP (000s)`, so shows a warning. Models provides two options: *Apply Factoring?* <mark style="color:green;">**(3)**</mark>, and *Override unit error?* <mark style="color:green;">**(4)**</mark>.

If *Apply Factoring?* is checked, the Calculation is automatically divided by `10^3 = 1000` <mark style="color:green;">**(5)**</mark>, and a tick mark <mark style="color:green;">**(6)**</mark> shows that the Variable Unit is now correct.

{% hint style="warning" %}
Selecting the *`Override unit error?`* option will remove the error, but the calculation will need to be modified manually. We recommend using the automatic factoring where available.
{% endhint %}

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FybewjZ15MWTLONEzfdRE%2Fimage.png?alt=media&#x26;token=f01c9583-fa70-4851-bc6d-c8ac6b68a47b" alt="Screenshot showing a Variable with a Unit matching error, due to non-matching factors"><figcaption><p>Error before Factoring applied</p></figcaption></figure>

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FNICSVMDBjrF9avT6Og98%2Fimage.png?alt=media&#x26;token=3ed1b9d9-bff9-49b0-ae2e-8d8c6bbd89e8" alt="Screenshot showing a Variable with automatic Factoring applied"><figcaption><p>Error after Factoring applied</p></figcaption></figure>

### Addition error

The screenshot below shows the result of adding together (or subtracting) items with different Unit Factors. In this case, we have a Variable, `Total Profits` <mark style="color:green;">**(1)**</mark> whose Calculation is `Total Revenues (000s) - Total Costs` <mark style="color:green;">**(2)**</mark>. As `Total Revenues (000s)` has Unit `GBP (000s)` and `Total Costs` has Unit `GBP`, Models is unable to determine the resulting Unit of the Calculation.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F3TRo6ZBzkcqOWfFgCVEN%2Fimage.png?alt=media&#x26;token=f5622e1f-5ec3-4bdd-9f72-b78ed0a3185e" alt="Screenshot showing a warning when adding/subtracting Variables of different Unit Factor"><figcaption><p>Error when adding/subtracting Variables with different factors</p></figcaption></figure>

In this case, the options are:

1. Manually edit the Calculation and select the *Override unit error?* option (see warning below)
2. Create a new Variable that converts one of the parts of the Calculation into the correct Factor first before using it in the Calculation (**recommended**).

{% hint style="warning" %}
We strongly encourage you **to use option 2** where possible. This will aid clarity of your Model and help other users understand the flow, while ensuring that you do not make a mistake manually converting between factors.
{% endhint %}
