*What if* variables help you ask 'what if?' questions in your reports. When you add a what if variable, a slider is displayed with the query. By adjusting the slider, the viewer can dynamically change the values of the variable within the limits you specify to see how it affects the results.

When you create a calculated metric, you can include a what if variable as a placeholder value. When a viewer adjusts the variable value, the formula will recalculate.

For information on creating calculated metrics in Explore, see Creating standard calculated metrics and attributes and Formula writing resources.

## Creating a what if variable

The first step to building a what if analysis is to create a what if variable. You cannot add a what if variable directly to the metrics, rows, or columns panels in Query Builder. Instead, you use it in the formula of a calculated metric, and *then* add the calculated metric to your query panel.

**To create a what if variable**

- In Query Builder, click
**Calculations**() on the right sidebar. - Under
**Attributes**, click**What if variable**. - Type a name for the variable.
- Configure the following values:
**Max value**: The greatest number users can select for the what if variable.**Min value**: The lowest number users can select for the what if variable.**Default value**: The default value for the what if variable.

- When you are finished, click
**Save**.

You can now add your what if variable to a calculated metric.

## Adding what if variables to calculated metrics

To use a what if variable in your report, you must use it in a standard calculated metric. The what if variable acts as a placeholder in the calculated metric formula. When a viewer selects a new value for the variable, the calculated metric will recalculate based on that value.

**To create a calculated metric including a what if variable**

- In the
**Calculations**menu () on the right sidebar, click**Standard calculated metric**,**Fixed calculated metric**, or**Benchmark metric**. See Calculated metric and attributes reference for more information on each of these calculated metrics. - From the
**Select a field**drop-down list, select the what if variable you created . - Enter the formula. The what if variable acts as a placeholder for whatever value you want it to represent.
This example measures the percentage difference between the current number of tickets and the what if variable value. The formula used would be below:

`(VAR(Example what if variable)-COUNT(Tickets))/(COUNT(Tickets)*100)`

- When you are finished, click
**Save**. - Add the calculated metric to the
**Metrics**panel in your query.

After you've added the metric to your query, you can adjust the what if variable value in your query and dashboard.

## Adjusting the what if variable value

After you've created a calculated metric, and added it to a query, you can adjust the value of the what if variable. You can change the what if variable value inside of a query, or on your dashboard.

**To adjust a what if variable value in a query**

- In the
**Result manipulation**menu () on the right sidebar, click**What if variables**. - Drag the circle to adjust the what if variable value or enter a value in the text box below the number line.
- Click
**Apply**.

The what if variable is updated. The formula you used in the calculated metric is readjusted to calculate using the what if variable value.

## 0 Comments

Please sign in to leave a comment.