# Variables

### In Models:

Variables are defined at Model-level so that they can be used in any expression that is being created at the Mode-level. The list of all the variables defined for the Model is available in the variables section. You can edit/delete/add new variables to the list.

#### How to create variables in models

* Model -> Expressions Tab -> Expressions
* Click on add Expression.
* The expression box can be used to define a dimension/measure expression
* Variables can be created by clicking on add variable button.&#x20;
* You can see the output in the preview box after clicking on the “**Validate**” button. It shows the output of the expression applied on the first 5 rows of data.

**Model -> Expressions Tab -> Variables:**

* You can create new variables here(as shown below). This section also shows all the defined variables at the Model level, along with options to make edits and delete variables.&#x20;
* A variable defined in the variable section becomes a **global variable** in the context of that model, meaning that the variables can be used within any of the expressions in the same Model.

<figure><img src="https://2657302904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazylpawQDleaF3gtrhZd%2Fuploads%2Fev2zeZy8mT1XhltDv6i3%2Fezgif.com-crop%20(10).gif?alt=media&#x26;token=6157ce56-25b9-4dbf-b56c-60969fed62e2" alt=""><figcaption><p>Variable Section</p></figcaption></figure>

### **In Reports**

The **run-time value** of the variables defined at the model level can be edited on the Reports-Edit Tab to get the desired output.

**In edit view:**

* The created variables can be seen in the left-hand side panel, where you can now find a tab with a variable icon along with Dimension and measure tabs.
* On Clicking the **Edit icon** on the created dimension/measure or the **Variable icon**, the **variable section** opens up.&#x20;
* The value of the variable can be controlled in real-time (as shown below). The value edited and saved **only applies to the Report** and *does not override* the default value of the variable at the Model level.

<figure><img src="https://2657302904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazylpawQDleaF3gtrhZd%2Fuploads%2FP7tC5rguYFpBPbL4gI3G%2Fezgif.com-crop%20(11).gif?alt=media&#x26;token=74a748de-a380-49b9-8a3f-53d8eeca3a7a" alt=""><figcaption><p>Adding variables in report</p></figcaption></figure>
