Tableau Parameters plays a significant role in creating Dynamic reports. For instance,
- While creating Filters, We can replace the Constant value with the Tableau Parameter value. It allows the user to set the Filter values dynamically as per his/her requirement.
- While creating Calculated Fields (or Calculations), We can replace the Constant value with the Parameter value. It allows the user to change the values as per his/her requirement.
In this article, we will show how to Create Tableau Parameters with an example. For this Tableau Parameters demo, we are going to write the Custom SQL Query against the SQL Server Data Source.
SELECT Cust.FirstName + ' '+ Cust.LastName AS [Full Name], Cust.YearlyIncome, Cust.EnglishOccupation, Fact.OrderQuantity, Fact.TotalProductCost, Fact.SalesAmount, Fact.TaxAmt, Fact.OrderDate FROM FactInternetSales AS Fact INNER JOIN DimCustomer AS Cust ON Fact.CustomerKey = Cust.CustomerKey
How to Create Tableau Parameters
This example shows how to create Tableau Parameters, Types of Parameters, and how to use them as Filters in Tableau.
First, Drag and Drop the Product Name from Dimension Region to Rows Shelf and Sales Amount Measures region to Columns Shelf. By default, tableau will generate the Bar Chart, as shown below. Please remember, We have 130 Rows in our Tableau Report
There are multiple ways to create Tableau Parameters
First Approach to Create Parameters in Tableau
Please click on the Dropdown arrow in the upper right corner of a Dimensions region and select the Create parameter.. option from the Drop downmenu as shown below
Second Approach to Create Parameters in Tableau
The second Method to create a parameters in Tableau is, Within the Data pane, Right Click on the Empty space to open the context menu. Please select the Create parameter.. option from it
Once you choose the Create parameter.. option, a new window called Create parameter will open. Within the Name section, specify a Unique name for the Parameter, and provide the valid comment by clicking the comment button
Please select the valid Data Type name from the Dropdown menu. For instance, if you choose a String data type from the list, the parameter can only accept string data. Here, we are selecting Integer Data Type
The Display Format option allows you to format the parameter value. For example, if you want the parameter to show the range between 10 percent to 80 percentage, you can use the Percentage otherwise, select Automatic
From the below screenshot, see we have three options in Allowable values. In this Tableau parameter example, we show you three possibilities with an example. First, we are selecting the All option as Allowable values.
Next, we added filter condition on Product Name. To do this, Please drag and drop the Product Name from Dimension Region to Filters Shelf. Once you complete, a new window will open to write the condition.
For now, we selected Top N products by Sum of Sales Amount, and instead of writing a constant number 10, we added our parameter value.
In some versions of Tableau, parameter control may display automatically. If this is not the case, please click on the Dropdown arrow in the upper right corner of a parameter name and select the Show Parameter Control option from the context menu
Once we complete, you can see the parameter control. By default, Our report will display Top 10 records because we specified the Current value as 10 while creating a parameter.
Let us change the value to Top 100. Notice that our tableau report is displaying the Top 100 product names
Tableau Range Parameters
Let us see what will happen when we change the Allowable values of Tableau parameters from All to Range. To edit the existing parameter, Please click on the Dropdown arrow in the upper right corner of the parameter name and select the Edit.. option from the context menu as shown below
TIP: You can create a New parameter in tableau rather than editing this old one
Let us change the Allowable values of Tableau parameters from All to Range and add the Minimum and Maximum values as per your project requirement.
- Minimum: Please specify the Minimum Range value. For now, we are adding 2 as the minimum value.
- Maximum: Please specify the Maximum Range value. Our report has 130 records so, we are adding 130 as a maximum value.
- Step Size: Scale step size. For now, we are adding 5 as Step Size because we have only 130 records. If your records are more, please feel free to change this value to 50, 100 or thousand
Please change the Tableau parameter display option from Type In to Slider. To do this, select the Dropdown arrow in the upper right corner of the parameter name and select the Slider option
Once completed, use the Tableau Slider to filter the Data as shown below
Tableau List Parameters
Let us change the Tableau parameters Allowable values from range to List and add the List of values as per your project requirement. For now, we are adding 4 values to the list.
- Value: This is the value tableau will use to filter the data. For example, if we set the value as 10, the report will display Top 10 records
- Display As: This will be a label name. It would help if you used the more meaning full name here
By default, it will display the value as 10 and label as Top 10. Notice that our tableau report is displaying the Top 10 product names
Let us change the value to Top 100. Notice that the tableau report is showing the Top 100 product names