# Key Unit Concepts

## &#x20;Calculation Consistency

Units allow you to ensure that [**Calculations** ](https://help.taglo.io/calculations)are consistent.

As a simple example, it is logically incorrect to sum together two [**Variables**](https://help.taglo.io/variables) which have a different unit.&#x20;

> Adding a Variable in `GBP` to a Variable in `USD` has no real meaning. If you attempt to do this, Models will warn you that it cannot determine the resulting Unit, which will prompt you to correct the Calculation. One of the two Variables should first be converted to the other currency, before summing, using an exchange rate Variable, with Unit `GBP/USD` or vice versa.

Non-additive operations, such as multiplication, transform Units.

> Multiplying an exchange rate with Unit `GBP/USD` by a Variable with Unit `USD` results in a Variable with Unit `GBP`.
>
> Squaring a Variable will raise the Unit to a power of 2: e.g., Distance in `metre` multiplied by itself will result in a Variable with Unit `metre^2`

Models will automatically derive the Units of your Calculations and tell you the resulting Unit, or display a warning if the Unit is not as expected.

## Units and Tags

Just like [**Dimensions**](https://help.taglo.io/dimensions) and other Taglo concepts, Units are based on [**Tags**](https://help.taglo.io/tags). Each Unit component (e.g. GBP, USD, metre) is itself an [**Abstract Tag**](https://help.taglo.io/tags/introduction-to-tags#abstract-vs.-concrete).

When you create a new type of Unit, you simply create a new Abstract Tag.

Use the Short Name property of a Tag to determine how the Tag will be displayed within a Unit (e.g., the `metre` Tag has a Short Name of `m`).

{% hint style="info" %}
Commonly used Units like currencies, units of time, and units of distance can be found in the built-in [**Namespaces**](https://help.taglo.io/using-taglo-software/namespaces).
{% endhint %}

### Inheritance

{% hint style="warning" %}
Unit inheritance analysis is available from Version 0.1.4.0 of Models
{% endhint %}

Because Units are based on Tags, they have access to all of the relationships you have created between Tags. This allows Models to make more intelligent inferences about the output Unit of a Calculation.

> For instance, if you have a Variable with Unit `Apple`, and a second Variable with Unit `Banana`, you should not ordinarily sum these Variables together, as explained [**above**](#calculation-consistency), and Models will warn you about it if you do.
>
> However, if the `Apple` and `Banana` Tags both have a third tag, `Fruit` as a common parent Tag, Models can infer that the Calculation is adding `Fruit` together, rather than Apples and Bananas, resulting in an output Unit of `Fruit`.

The above example will be represented in the Variable view as in the screenshot below. When a Variable is reliant on inheritance to calculate or correctly match its Unit, as is the case for Total Fruit below, Models will show a warning <mark style="color:green;">**(1)**</mark>, in the Variable.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FT3r9IrvqFHxC2sERqMlb%2Fimage.png?alt=media&#x26;token=5a93194f-880f-4794-b206-f613632d13e1" alt="Screenshot showing an example of Unit inheritance. There are three Variables: Bananas, Apples, and Total Fruit. Total Fruit is a parent of the Apples and Bananas Variables. The Total Fruit Variable has a visual warning that its Unit is only valid because its calculation components have a common ancestor."><figcaption><p>Unit inheritance example</p></figcaption></figure>

#### Disabling Inheritance

Unit inheritance can be enabled/disabled in the [**Model settings**](https://help.taglo.io/models/model-editor#model-settings-bar) wizard, as shown below. Open the settings wizard from the Model Settings bar, and select or deselect the **Allow Unit inheritance** option <mark style="color:green;">**(1)**</mark> as required.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F0r78khUdB0qg5UkGdkn7%2Fimage.png?alt=media&#x26;token=0444e484-ed18-4084-8619-d9bfbab38718" alt="Screenshot of the Model Settings dialog, highlighting the option to Allow Unit Inheritance"><figcaption><p>The Allow Unit Inheritance setting</p></figcaption></figure>

## Compound Units

Many Units are Compound Units: for example, the exchange rate `GBP/USD`. In Taglo, we refer to each component of the Unit as a **Unit Part**.&#x20;

{% hint style="info" %}
In this example, the `USD` Unit Part has an **Order** of `-1`, making it the denominator of the Unit.
{% endhint %}

In the next section, [**Advanced Units**](#advanced-units), you will learn how editing each Unit Part adds functionality to Taglo software.

## Summary

Units help you achieve logical consistency in your calculations. Models allows you to add extra time and contextual detail to your Units, which provide useful information about how the [**Variables**](https://help.taglo.io/variables) and [**Assumptions**](https://help.taglo.io/assumptions) in your Model should be treated.

As you read more about working in Models, you will see how these concepts are used to enable powerful functionality.

> For instance, [**Dimensions**](https://help.taglo.io/dimensions) work by automatically applying context Tags to the underlying Unit of a Variable.&#x20;

Read on to learn how to create Units.
