Parameters In Tableau

 

1Introduction

A parameter is a workbook variable that can replace a fixed value in a calculation, filter, or reference line with a number, string, or date.  For example, you could generate a calculated field that yields True if Sales exceed $500,000 and False otherwise. A parameter can be used to swap the constant value “500000” in the formula. Then, using the parameter control, you can change the threshold in your calculation dynamically. We will explore Parameters in Tableau with examples in this article.

 

2Why Parameters in Tableau Visualization?

You can also set a dynamic parameter to automatically refresh its current value (the result of a single-value, view-independent calculation), a list of values (based on a data source column), or a range of values. This occurs whenever the workbook is opened and Tableau connects to the data source specified by the parameter, or whenever you select Refresh from the data source’s context menu.

By using Parameter Actions, you can make your parameters more dynamic and interactive. Parameter actions allow your audience to change a parameter value by interacting directly with a viz, such as by clicking or selecting a mark.

Get satisfying hands-on with real-time projects join Tableau Training in Chennai at SLA.

 

2.1Create a Parameter

To create a new parameter from the Data pane, follow the steps below.

Step 1: In the Data pane, select Create Parameter from the drop-down arrow in the upper right corner.

 

Create A Parameter

Step 2: Give the field a name in the Create Parameter dialogue box.

 

Create Parameter Dialogue

Step 3: Set the data type for the values that will be accepted:

 

Data Type For The Values

Step 4: Enter a current value. This is the parameter’s default value. Let’s leave the field alone in this case because we’ll be using the most recent data, which we’ll configure in the next step.

 

Enter The Current Value

Step 5: When the workbook is opened, enter a value. In this case, let’s make a dynamic parameter by setting the parameter’s default value to the outcome of a single-value, view-independent calculation.

 

Latest Month

Let’s use the most recent month for this dynamic parameter. This means that if the connected data source is updated while the workbook is open, the parameter will automatically update.

Step 6: Be sure to provide the display format for the parameter control (Tableau Desktop only).

 

Tableau Desktop Only

Step 7: Define the parameter’s value-accepting rules. It can be from the following three:

All – The parameter control is a straightforward text box.

List: You can choose from a list of potential values provided by the parameter control.

Range: You can choose values from a given range using the parameter control.

The data type affects whether these choices are accessible. For instance, a string parameter can only accept a list of all possible values. A range is not supported.

You must specify the list of values if you choose List. You can enter members of a field by choosing Add values from, or you can click in the left column to input your list of values.

 

List Of Values

You must enter a minimum, maximum, and step size if you choose Range. For instance, to construct a parameter control that allows you to pick each month in 2019, you could specify a date range between January 1 and December 31, 2019, with the step size placed to 1 month.

 

Range Of Values

Select List, followed by When the workbook opens, to automatically update the parameter’s list of values (or domain) each time the workbook opens. Due to the worksheet dynamically retrieving information from the data source, the list of values on the left is greyed out.

Step 8: After you’re done, click OK.

The parameter is now visible in the Data pane’s Parameters section at the bottom.

 

Number Of Records

The parameter is also accessible in any other place where you can use one, such as the Reference Line dialogue box or the Top tab of the Filter dialogue box. All worksheets in the workbook can use parameters because they are global variables

Understand how to merge multiple data sets using the data blending method through our recent article “Data Blending in Tableau”.

 

2.2Failure to update the parameter value or list of values

Here are a few instances where a default parameter value or a list of refreshable parameter values (domain) won’t update as expected:

 

      • The default field returns a value whose data does not match the data type of the argument.

      • For the parameter’s current value, the default field doesn’t return a single value.

      • Fields by default return null.

      • The default field is located in an unconnected data source.

      • The default field has been erased and is no longer present in the namespace of the workbook.

    • While Tableau is attempting to connect, the user cancels the data source query.

 

2.3Edit a Parameter

Either the parameter control or the Data pane can be used to edit parameters. To edit a parameter, follow the steps below:

Choose one of these :

 

      • Select Edit by performing a right-click (Control-click on a Mac) on the parameter in the Data pane.

      • On the parameter control card menu, choose Edit Parameter.

      • Make the appropriate changes in the Edit Parameter dialogue box.

    • After you’re done, click OK. The calculation that uses the parameter is updated as well.

 

2.4Use a Parameter in a Calculation

You can dynamically change the values of a calculation by using parameters. You can use a parameter in place of manually modifying the computation (and any dependent calculations). Then, any computations that depend on that parameter are updated when you alter the value by opening the parameter control and changing it.

Drag the parameter from the Data pane and drop it in the calculation editor to add it to the formula in a new place or to replace a portion of the existing formula:

 

Use A Parameter In A Calculation

 

2.5Use a Parameter in a Filter

You can dynamically change values in a Top N filter by using parameters. You can use a parameter in place of explicitly specifying how many values to display in the filter. The filter then updates as soon as you access the parameter control to modify the value. You might want to use a parameter rather than the fixed “10” number when building a filter, for instance, to display the Top 10 products based on total profit. The filter can then be simply updated to display the top 10, 20, or 30 products.

The drop-down lists on the Top tab of the Filter dialogue box include a list of options. In this case, choose the parameter you want to utilize in the filter.

 

Top Products

Right-click the parameter in the Data pane and choose Show Parameter to display the parameter control. Use the parameter control to change the filter so that it displays the top 10, 15, 20, and so forth products.

 

Data Pane

 

2.6Use a parameter in a reference line

You can dynamically change a reference line, band, or box using parameters. You may refer to a parameter, for instance, rather than drawing a reference line at a specific point on the axis. The parameter control can then be used to move the reference line.

The Value drop-down menu in the Add Reference Line, Band, or Box dialogue box contains a set of parameters. Decide which parameter to use.

 

Use A Parameter In A Reference Line

At the Current Value that the parameter specifies, the reference line is drawn. Right-click (Control-click on a Mac) the parameter in the Data pane and choose Show Parameter to display the parameter control. To alter the location of the reference line, use the parameter control. 

Want to know the differences between Power BI and Tableau? Read our latest updated article.

 

2.7In the viz, display a parameter control

The worksheet card that acts as the parameter control allows you to change the parameter value. Filter cards and parameter controls are extremely similar in that both have controls for changing the view. When you save to the web or publish to Tableau Server, parameter controls are included and can be opened on worksheets and dashboards.

Right-click (Control-click) the parameter in the Data pane and choose Show Parameter to display the parameter control.

 

In The Viz Display A Parameter Control

Parameter controls, like other cards, include a menu that may be accessed by using the drop-down arrow in the card’s top right corner. You can modify the control’s display using this menu. A list of values could be displayed as radio buttons, a compact list, a slider, or a type-in field, for instance. The selections on this menu are determined by the parameter’s data type and whether it accepts all, a list of values, or a range of values.

 

Parameter Controls

 

3Conclusion

We learned about parameters in Tableau in this article. Following a demo of how to create a parameter in Tableau, we showed how to utilize parameters, how to change them, and how to use parameters as filters. We sincerely hope that this blog helped you easily comprehend and learn about parameters. Join our Tableau Training in Chennai at SLA to learn about a wider range of opportunities in the data visualization process.