Tableau Parameters plays a major role in creating Dynamic reports. For instance,
- While creating Filters, We can replace the Constant value with the Tableau Parameter value. This will allow 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. This will allow the user to change the values as per his/her requirement.
In this article, we will show you, How to Create Tableau Parameters with an example.
For this we are going to write the Custom SQL Query against the SQL Server Data Source so, Please visit Connecting Tableau to SQL Server article to understand the configurations.
The custom SQL query we are going to use for this Tableau Parameters report is:
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
In this example, we will show you, 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
The Tableau Parameters can be created in Multiple ways:
First Approach to Create Parameters in Tableau
Please click on the Drop down arrow in the upper right corner of a Dimensions region and select the Create parameter.. option from the Drop down menu as shown below
Second Approach to Create Parameters in Tableau
Second Method to create parameter in tableau is, Within the Data pane, Right Click on the Empty space will open the context menu. Please select the Create parameter.. option from Context menu as shown below
Once you select the Create parameter.. option, a new window called Create parameter will be opened as shown below. Within the Name section, please specify the Unique name for the Parameter and provide the valid comment by clicking the comment button
Please select the valid Data Type name from the Drop down menu. For instance, if you select String data type from the menu then parameter can only accept string data. Here, we are selecting Integer Data Type
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 you can observe that we have three options in Allowable values. In this Tableau parameters example, we will show you 3 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 are done, a new window will be opened to write the condition.
For now, we selected Top N products by Sum of Sales Amount and instead of writing constant number 10, we added our parameter value.
In some versions, parameter control may display automatically. If this is not the case, Please click on the Drop down arrow in the upper right corner of a parameter name and select the Show Parameter Control option from context menu as shown below
Once you are done, 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 Drop down 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 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 parameter display option from Type In to Slider. In order to do this, Please click on the Drop down arrow in the upper right corner of the parameter name and select the Slider option from the context menu as shown below
Once you are done, you can 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 for filter the data. For example, if we set value as 10, the report will display Top 10 records
- Display As: This will be label name. you should use 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 displaying the Top 100 product names
Thank You for Visiting Our Blog