Tableau is one of the widely used Business Intelligence tools by most of the IT companies. It can connect to any data source and provide visualizations on top of that data. It also allows for report sharing with Peers. Tableau comes in 5 variants that serve different purposes - Tableau Desktop, Tableau Online, Tableau Server, Tableau Prep, and Tableau Public. Creating flexible reports enables businesses to get deeper insights. Tableau provides parameters that help in creating flexible reports. In this post, we will explain the importance of parameters in Tableau. We will also explain how to create parameters and how to use them. So without further ado, let's dive deep into this topic.
Parameters are place holders of values in Tableau. A parameter can be text, an integer, or a range of values. It helps in replacing values in calculations, filters, and the reference line. When you want to input something to your report that is not present in your data, you can pass it through parameters.
For example, when you are creating a sales report, and you want to control the view by the sale amount, you can use a parameter in the calculation. So when you want to look at the sales that are below 10000, you can pass that value to the parameter. Or, if you want to look at the sales above 50000, you change the value of the parameter dynamically.
You can also set a dynamic parameter that changes automatically based on the data source. You can use the parameters in Parameter Actions to make your reports more interactive and dynamic. So the viewers can change the parameter value when they interact with the report, i.e., a viz. This helps the viewers to choose how they want to view the report.
Open Tableau Desktop and navigate to the Data Pane. Click on the drop-down arrow in the top right corner and choose 'Create Parameter'. You will get a parameter dialog box, give a name for the parameter you want to create. Choose a data type from the drop-down. If you want to set the current value to the parameter, mention it in the 'Current Value' field.
Choose the 'Current Value' option from the drop-down for the 'Value when the workbook opens' field. Choose 'Automatic' from the drop-down for the 'Display Format' field. The next option is for specifying how the parameter allows values. It has the below options for the 'Allowable Values' field to choose from.
These options will depend on the data type that you selected for the parameter. If you choose a list, then you have to provide a list of values. You can directly start adding the values for the list, or you can add them through the 'Add values from' option. If you choose the range option, you have to specify the minimum, maximum, and step size. Once you fill all the details, click on 'Ok'. You can view the created parameter in the Parameters section at the bottom of the Data Pane.
Go to the Data pane, where you can view all the available parameters. Right-click on the parameter that you want to modify and choose the 'Edit' option. Select the 'Edit Parameter' option from the control menu. You will get an 'Edit Parameter' dialog box where you can modify the fields that you wish. Once all the changes are done, click on 'Ok' to save. The parameter will get updated wherever it is in use.
Here are a few cases where the parameter value or a refreshable list of values won't refresh.
When Tableau encounters any of the above scenarios, it will keep the latest value for the 'Current Value' field.
You can use parameters in calculations so that you don't have to edit the calculations every time you want to modify something. When you want to change the value, you can go to the parameter available in the Data pane and edit it. It helps in dynamically changing the values in calculations. While writing a calculation in the calculation editor, drag the parameter that you want to use, and drop it into the calculation editor. Click on 'Ok' to finish.
In a filter, you can use parameters to modify values for the Top N filter. Instead of setting a specific value for the filter, you can use a parameter to set the value dynamically by the user. For example, if you want to create a report that shows the top 5 sales, you can use the parameter in place of it. So you can change the report to show the top 10, 15, or 20 sales.
Open the filter dialog box, go to the 'Top' tab. Select the 'By field' radio button. You will have a drop-down for the 'Top' option. You can choose the available parameters from the drop-down, or you can create a parameter right there.
You can modify a reference line, band, or box by using parameters for it. So the reference line can be moved according to your preference, instead of fixing it at a location on the axis. Open the 'Add Reference Line, Band, or Box' dialog box. You will get the list of available parameters in the drop-down of the 'Value' field. You can choose one or create a new parameter right there.
Linking two parameters is important in Tableau when you want to make one parameter dependent on other parameter filters. This means that the output of the first parameter will be the input of the second parameter. For instance, consider that you have a map visualization for sales in all the states. You also have a visualization that shows the sales, stock, and demand based on state. Now, if you want to link these two visualizations, i.e., when the viewer selects a state on the map, the next visualization should show the sales, stock, and demand for that state. Here is the process on how to link parameters.
Parameter controls are similar to filter cards that contain the controls to modify the view. The parameter controls are available for both the worksheets and dashboards. They will also be available to the viz that you publish to Tableau Server or Tableau Online. Now that you learned about parameters, you can try using them in your visualizations in Tableau. For more details, refer to our other posts on Tableau on our website.