> For the complete documentation index, see [llms.txt](https://docs.sprinkledata.com/product/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinkledata.com/product/analysing-your-data/data-models/variables.md).

# 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="/files/UPwmP9t7jTjbBK0Q8dC2" 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="/files/PGddCu8uF0KlG59W6YHo" alt=""><figcaption><p>Adding variables in report</p></figcaption></figure>
