Creating parameters

Creating a parameter is similar to creating a calculated field.

There are multiple ways to create a parameter in Tableau:

In the last case, Tableau will create a parameter with a list of potential values based on the domain (distinct values) of the field. For fields in the data pane that are discrete (blue) by default, Tableau will create a parameter with a list of values matching the discrete values of the field. For fields in the data pane that are continuous (green), Tableau will create a parameter with a range set to the minimum and maximum values of the field that's present in the data.

When you first create a parameter (or subsequently edit an existing parameter), Tableau will present an interface like this:

The interface contains the following features:

  1. The Name will show as the default title for parameter controls and will also be the reference in calculations. You can also add a Comment to describe the use of the parameter.
  2. The Data Type defines what type of data is allowed for the value of the parameter. Options include integer, float (floating point decimal), string, Boolean, date, or date with time.
  3. The Current Value defines what the initial default value of the parameter will be. Changing this value in this screen or on a dashboard or visualization where the parameter control is shown will change the current value.
  4. The Display format defines how the values will be displayed. For example, you might want to show an integer value as a dollar amount, a decimal as a percentage, or display a date in a specific format.
  5. The Allowable Values option gives us the ability to restrict the scope of values that are permissible. There are three options for Allowable Values:
  1. In the preceding screenshot, the List of Values allows us to enter all possible values. In this example, a list of three items has been entered. Notice that the value must match the data type, but the display value can be any string value. This list is static and must be manually updated. Even if you base the parameter on the values that are present in a field, the list will not change, even if new values appear in the data. You can drag and drop values in the list to reorder the list.
If you are using a list of options, consider an integer data type with display values that are easily understood by your end users. The values can be easily referenced in calculations to determine what selection was made, and you can easily change the display value without breaking your calculations. This can also lead to increased performance, as comparisons of numeric values are more efficient than string comparisons. However, you'll want to balance the flexibility and performance of integers with readability in calculations.
  1. With allowable values of List or Range, you'll get a series of buttons that allow you to obtain the list of values or range from various sources. Add from Parameter copies the list of values or range from an existing parameter; Add from Field copies the list of distinct values or range from a field in the data, while Paste from Clipboard creates the list of values from anything you have copied to the system clipboard. Clear All will clear the list of values.
  2. Click OK to save changes to the parameter or Cancel to revert.

When the parameter is created, it appears in the data pane under the Parameters section. The drop-down menu for a parameter reveals an option, Show Parameter Control, which adds the parameter control to the view. The little drop-down caret in the upper right of the parameter control reveals a menu for customizing the appearance and behavior of the parameter control. Here is the parameter control, shown as a single value list, for the parameter we created earlier:

This control can be shown on any sheet or dashboard and allows the end user to select a single value. When the value is changed, any calculations, filters, sets, or bins that use the parameter will be reevaluated, and any views that are affected will be redrawn.