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 report. 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 the report builder. Instead, you use it in the formula of a calculated metric, and then add the calculated metric to your report panel.
- In the report 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.
- In the Calculations menu () on the right sidebar, click Standard calculated metric or Fixed calculated metric. See Calculated metric and attributes reference for information on about 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 report.
After you've added the metric to your report, you can adjust the what if variable value in your report and dashboard.
Adjusting the what if variable value
After you've created a calculated metric, and added it to a report, you can adjust the value of the what if variable. You can change the what if variable value inside of a report, or on your dashboard.
- 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 will be readjusted to calculate using the what if variable value.
I'm not seeing a slider or What If variables section come up
Hi Amanda, the What If variables option appears in the menu only after you've added a calculated metric that includes a what-if variable in its formula. So if you create a what-if variable, use that variable in a calculated metric, and then add that metric to the report, the menu option should appear!
Hi Erin, I had done that, and it did not appear.
Amanda In that case, I'm not quite sure what's preventing the menu option from appearing! I'll open a support ticket on your behalf so we can look into this.
Please sign in to leave a comment.