A parameter is a workbook variable such as a number, date, or string that can replace a constant value in a calculation, filter, or reference line. You can make your parameters more dynamic and interactive by using them in Parameter Actions.
The parameter is a variable (numbers, strings, or date) created to replace a constant value in calculations, filters, or reference lines. For example, you create a field that returns true if the sales are greater than 30,000 and false if otherwise. Parameters are used to replace these numbers (30000 in this case) to dynamically set this during calculations. Parameters allow you to dynamically modify values in a calculation. The parameters can accept values in the following options:
- All: Simple text field
- List: List of possible values to select from
- Range: Select values from a specified range
A parameter will allow you to provide a value to pass into Tableau. Parameters allow you to come up with scenarios or options that are not available in your data and create these values to put into your visualization. After creation, end users can control the input to see the results of the parameters effect.
A parameter is a workbook variable such as a number, date, or string that can replace a constant value in a calculation, filter, or reference line.
For example, you may create a calculated field that returns True if Sales is greater than $500,000 and otherwise returns False. You can replace the constant value of “500000” in the formula with a parameter. Then, using the parameter control, you can dynamically change the threshold in your calculation.
You can even create a dynamic parameter that’s set to automatically refresh its current value (to the result of a single-value, view-independent calculation), list of values (based on a data source column), or range of values. This will happen each time the workbook is opened and Tableau connects to the data source referenced by the parameter, or whenever you select Refresh from the data source’s context menu…
You can make your parameters more dynamic and interactive by using them in Parameter Actions. Parameter actions let your audience change a parameter value through direct interaction with a viz, such as clicking or selecting a mark.
Follow the instructions below to create a new parameter from the Data pane.
- In the Data pane, click the drop-down arrow in the upper right corner and select Create Parameter.
- In the Create Parameter dialog box, give the field a Name.
- Specify the data type for the values it will accept:
- Specify a current value. This is the default value for the parameter. In this case, let’s leave the field as is because we’ll be using the latest data, which we’ll configure in the next step.
- Specify a value when the workbook opens. In this case, let’s create a dynamic parameter by setting the parameter’s default value to the result of a single-value, view-independent calculation.
- For this dynamic parameter, let’s use Latest Month. This means that if the connected data source is updated and the workbook is opened, the parameter will automatically update when the workbook is opened.
- Specify the display format to use in the parameter control (Tableau Desktop only).
- Specify how the parameter will accept values. You can select from the following options:
- All - The parameter control is a simple text field.
- List - The parameter control provides a list of possible values for you to select from.
- Range - The parameter control lets you select values within a specified range.The availability of these options is determined by the data type. For example, a string parameter can only accept all values or a list. It does not support a range.If you select List, you must specify the list of values. Click in the left column to type your list of values, or you can add members of a field by selecting Add values from. If you select Range, you must specify a minimum, maximum, and step size. For example, you can define a date range between January 1, 2019 and December 31, 2019, with the step size set to 1 month to create a parameter control that lets you select each month in 2019.In this case, to refresh the parameter’s list of values (or domain) whenever the workbook opens, select List, and then select When workbook opens. Notice that the list of values on the left is grayed out because the workbook is dynamically pulling values from the data source.
- When finished, click OK.The parameter is now listed in the Parameters section at the bottom of the Data pane.The parameter is also available everywhere else you can use a parameter—for example, on the Top tab in the Filter dialog box, or in the Reference Line dialog box. Parameters are global across the workbook and can be used in any worksheet