Parameters in Tableau enable users to add some advanced calculations and calculated fields. Parameters provide adding a non-existing variable to the entire work and simplify the needs and requirements to analyze and visualize the data.
What are the Parameters in Tableau?
The parameters in Tableau are the workbook variables like a number, date, or calculated field that allows users to replace a constant value in a calculation, filter, or reference line.
For example, the user can create a new calculated field that returns True if the aggregate of total marks is greater than 90% and returns False if it is less than 90%. Users can replace the constant value of "90%" in the formula with the parameters in Tableau as per the requirements. With the parameter control, users can dynamically vary the threshold values in their calculation.
Hope you got a basic idea of parameters in Tableau. Let us move ahead and understand how parameters in Tableau are created.
How to Create Parameters in Tableau?
There are multiple possibilities of creating the Parameters in Tableau based on the user's requirements. In this practical section, you will see the most commonly used Parameters. Here, this tutorial will use the Sample Superstore Dataset available in Tableau Public.
- Top N Parameters in Tableau
- Date Field Parameters in Tableau
- Dynamic Measures
- Dynamic Dimensions
Top N Parameters in Tableau
The following are the steps to create Top N Parameters in Tableau.
- In this Parameters demo, you will find the Top N Sub-Categories giving maximum sales.
- Start Tableau and import the sample superstore dataset.
- Please create a new sheet and rename it as Top N Parameters, for your reference.
- Now, select sales from the measures tab and drag it to rows.
- Select sub-category from dimensions and drag it to columns.
- Tableau will automatically generate a bar chart as shown below.
- The orientation can be changed if necessary.
- The next step is to organize the chart in descending order of the sum of sales.
- To find the Top N Sub-Categories giving the maximum sales, drag the sub-category pill from dimensions onto the filter in the marks-sheet.
- A new "filter" dialogue box will pop-up on the screen.
- Select the top option in the menu bar.
- Select the field option
- Select the new parameter option
- Rename the parameter
- Select the list option
- Write in the values and type in the text into the "display as" option.
- Make sure the aggregation is SUM.
- Select the OK option.
- Under the measures template, you can find the newly created parameter.
- Select the newly created parameter and right-click the pill.
- Select the show parameter option and select the top 10 option.
- The Tableau will provide the Top N Parameter list on the screen.
- Select Top 10 and Tableau will present the output.
With that, you have seen how to create Top N Parameters in Tableau. Next, this tutorial will look into the Date Parameters in Tableau.
Date Field Parameters in Tableau
In the date parameters, you will find out the sales according to the dates. It could be in terms of a year, quarter, month, week, or day. The "Parameter options" will be available in the parameter.
Now, the following steps are needed to be followed to create a date parameter.
- Please create a new sheet and rename it as Date Parameter.
- Drag order date to rows and sales to the tt table as shown below.
- The resultant text table will as follows.
- To create a new parameter, select the arrow icon in the top left corner and select the create parameter option as shown below.
- The new parameter dialogue box will appear on the screen.
- Rename the parameter as date parameters
- Select the datatype as string.
- Select the list option
- Add the values and "display as" details and select OK as shown below.
According to the year, quarter, month, week, and day, you need a new calculated field to display the sales.
- Create a new calculated field named date calculation.
- Go to the arrow icon option in the top left corner.
- Select the arrow icon and click on the "create a calculated field" option, as shown below.
- A new window will appear on your screen. Here you can add your queries, as shown below.
- Write the following query in the date calculation window and select OK as shown below.
CASE [Date Parameter ]
WHEN "Year" THEN STR(YEAR([Order Date]))
WHEN "Quarter" THEN STR(YEAR([Order Date]))+"/Q"+ DATENAME('quarter', [Order Date])
WHEN "Month" THEN DATENAME('month',[Order Date])+""+STR(YEAR([Order Date]))
WHEN "Week" THEN "Week" + STR(DATEPART('week',[Order Date]))
WHEN "Day" THEN STR(DATE([Order Date]))
- Now, you have the date parameter in the parameters section and date calculation in the dimensions section.
- Next, change the text table to a bar graph. Select the ‘Show me’ tab and choose the option of a bar graph in the list.
- The text table will not get converted into a bar graph.
- Select the marks sheet's label option to give you the details related to sales in a readable format.
To visualize the sales in terms of the year, quarter, month, week, or day, you need to use the Date Parameters. Select the Date Parameters option from the parameters panel and right-click the pill, and select the show parameter option as shown below.
- The parameters option will be shown as follows.
Moving on, select the month option, and Tableau will provide you with sales information per month.
Advancing, we will look into Dynamic measures and Dynamic Dimensions.
To create the Dynamic Dimensions parameter, you need to execute the following steps.
- Please create a new sheet and rename it as Dynamic Dimensions.
- Create a new parameter. Select the arrow icon and click on the new parameter option.
- Now, rename the parameter as Dynamic Dimension Parameter.
- Select the datatype as a string.
- Select category, ship-mode, and segment dimensions from the dimensions panel.
- Select the OK option and now, create a new calculated field.
- Hover over to the arrow icon and select "create a calculated field."
- Write the following code in the calculated field window and select OK as shown below.
CASE [Dynamic Dimension]
WHEN "Category" THEN [Category]
WHEN "Ship Mode" THEN [Ship Mode]
WHEN "Segment" THEN [Segment]
- Now, you can find the newly created dynamic dimension parameter and dynamic dimension calculated fields in the left panel.
- Drag the Dynamic Calculation field from dimensions panel to columns
- Drag category to columns
- Drag sales to rows
- Now right click on the Dynamic Dimensions parameter pill and select the show parameter option.
Now, take a look at the Parameter menu. The output is now capable of visualizing dynamic dimension data based on dimensions like Category, Ship-mode, and Segment, as shown in the following output image.
Up next, it’s time to learn about Dynamic Measures.
Now, Dynamic Measures are completely similar to Dynamic Dimensions, with only one difference. Instead of Dimension values, we use Measure values.
To create a Dynamic Measures Parameter, you need to follow the steps as explained below.
- Please create a new sheet and rename it as Dynamic Measures Parameter for reference.
- Create a new parameter. Select the arrow icon click on the new parameter option.
- Next up, rename the parameter as Dynamic measures parameter.
- Select the data type as a string.
- Moving on, select the list option and write the sales, profit, and quantity values as shown below.
- Now you will find a newly created pill in the parameters panel.
- The next step is to create a new calculated field.
- Select the arrow icon, click on the create new calculated field option.
- A new calculated field window will appear on the screen.
- Type the following formula and select OK to create a new calculated field.
CASE [Dynamic Measure Parameter ]
WHEN "Sales" THEN [Sales]
WHEN "Profit" THEN [Profit]
WHEN "Quantity" THEN [Quantity]
- Now, you can find a newly created calculated field in the measures panel.
- Drag the newly created calculated field in the measures panel to rows.
- Drag category from dimensions to columns.
- Tableau will automatically generate a bar chart.
- Now right-click on the newly created parameter and select the show parameter option.
- Now, select the label icon from the marks card and tick the label box.
- The final result will look as follows.
In the next section, this tutorial will explore some of the important differences between parameters and filters.
Parameters in Tableau vs. Filters in Tableau
Parameters are preferred for Static Data
Filters are used for Dynamic Data
Parameters are implemented to the entire workbook
Filters can be implemented to specific sheets only
Multiple values cannot be selected while implementing Parameters
Multiple values can be selected while implementing Filters
Parameters are implemented using Calculated fields
Filters do not use calculated fields
Parameters support multiple datatypes
Fields cannot support multiple datatypes
With that, you have reached the end of this tutorial titled "What Are Parameters in Tableau and How to Implement Them?".
Master data visualization, business intelligence tool and advance your career in analytics with the Tableau Certification Training Course. Enroll now.
LOD Expressions in Tableau can be your next stop. LOD Expressions in Tableau will help you explore the smallest granularities in your data and apply them to the entire workbook.
To move forward, the link to your next stage is here, LOD Expressions in Tableau.
Want to improve your skillset and gain better knowledge on Tableau to become certified as a Tableau Professional? Then explore Simplilearn's Tableau training and certification website. The program is designed by Experts and delivered by practitioners; Simplilearn’s Tableau program could help you move forward in your career.
If you have any questions about the topics in this tutorial, please leave them in the comments section at the end of this page, and our team of experts will answer them for you at the earliest!