# 18. Variables

Analysts are often faced with the challenging task of navigating large datasets that span across multiple dimension categories and time frames - this is where Inforiver variables can save the day. Variables offer a range of options to efficiently traverse your datasets, apply filters, and even run ad-hoc scripts. Variables are graphical controls like buttons, checkboxes, or steppers that can accept user input to perform actions like setting a filter or changing the layout.&#x20;

See how variables can make report navigation and editing easier without creating Inforiver filters or manually editing the header or visual measures.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2F1rwQbSyWpA725VRMOWwz%2F2.2.%20variables-gif.gif?alt=media&#x26;token=d07d5502-e857-4962-8265-6a261b94505e" alt=""><figcaption><p>Variable controls in Inforiver</p></figcaption></figure>

Let's take a deep dive into Inforiver variables.

## 1. Creating variables

**STEP 1:** You can create variable controls in your reports by clicking the **Variables** button in the **Insert** ribbon.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FiXo9zSm0M2AxgrBczZcn%2Fimage.png?alt=media&#x26;token=c7752d29-df13-49d6-b69c-8f1a22abc57e" alt=""><figcaption><p>Creating variables</p></figcaption></figure>

**STEP 2:** Click the **Add Variable** button in the **Define Variables** window. You'll need to specify the&#x20;

* **Label**: Set a name to identify the variable.
* **Type**: Choose the type of variable: numeric, options, text, button, boolean, date range, etc.
* **Value**: Set a default value for the variable.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FPP89vkYRKGun9jHgCqCC%2Fimage.png?alt=media&#x26;token=afbe2975-e022-4980-9cb6-624204ad05e1" alt=""><figcaption><p>Different types of variables</p></figcaption></figure>

**STEP 3:** Click the edit<img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FK5K0jiNNr3GRgnf0xDgO%2Fimage.png?alt=media&#x26;token=09636d8a-5bff-433a-a811-c80d985f5f55" alt="" data-size="line"> icon to customize the variable. We'll cover the various options in detail in subsequent sections.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2F22GPdGmNEa03cQ45VKOc%2Fimage.png?alt=media&#x26;token=38d462b2-4285-4403-8d32-557a4473c0a5" alt=""><figcaption><p>Variable properties</p></figcaption></figure>

**STEP 4:** You can display variables in a side panel. Check the **Include in Variables Panel** option if you want to expose the variable in the Variables panel. You can also provide a description of the variable's function.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FgIzqhUo22wXFH1ZJSvY4%2Fimage.png?alt=media&#x26;token=03e0d420-3a96-47b8-88b6-77d852008c06" alt=""><figcaption><p>Include variable in panel</p></figcaption></figure>

Variable names are automatically displayed by default in the writeback matrix visual when a variable is defined. The **Show Label in Variables panel** is auto-checked when a variable is defined. You can uncheck this option while defining a variable to hide the label name.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FaLkRHI1sw8YJLFjtW0Tm%2Fimage.png?alt=media&#x26;token=c2fef69c-3770-441b-9ea4-17f9fbfeaf99" alt=""><figcaption><p>Show Label in Variables Panel is auto-checked</p></figcaption></figure>

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FOWEXHfoqB9sHEZSl7bLk%2Fimage.png?alt=media&#x26;token=aa35773e-8a8a-418d-ae67-bffbf376d324" alt=""><figcaption><p>The variable name is being displayed.</p></figcaption></figure>

After you create variables, the variables side pane is displayed from where users can input values for calculations, apply filters, and trigger scripts.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FCrxFJRQ8m2iqnEY8mQL7%2Fimage.png?alt=media&#x26;token=81fa3305-b765-4091-920b-4bff3f202c51" alt=""><figcaption></figcaption></figure>

## 2. Referencing variables in functions

You can create a calculated measure that references the value set in a variable. Each variable has a **Technical Name** that can be referenced in formulas.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FaVoUZjsMm7oiBxGDxYap%2Fimage.png?alt=media&#x26;token=d746b440-4c0e-4c07-909b-4c10a51de1e9" alt=""><figcaption><p>Technical name of the variable</p></figcaption></figure>

In this example, the calculated measure, Tax will change based on the toggle variable.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2Fl2y4rIFZe2tuwGRl7pfo%2Fimage.png?alt=media&#x26;token=bba6acb6-7c55-4ba0-9ba5-7cb242fe2b16" alt=""><figcaption><p>Referencing the technical name is formulas</p></figcaption></figure>
