Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Introduction to Parameters in Tableau
3.
Creating a Parameter in Tableau
4.
Using Parameters in Tableau
4.1.
Using a Parameter as a Filter
4.2.
Using a Parameter in a Calculation
4.3.
Using a Parameter in a Reference Line
5.
Frequently Asked Questions
5.1.
What is the purpose of Parameters in Tableau?
5.2.
Are there any limitations to using parameters in Tableau?
5.3.
What are the types of parameters in Tableau?
6.
Conclusion
Last Updated: Mar 27, 2024
Easy

Parameters in Tableau

Create a resume that lands you SDE interviews at MAANG
Speaker
Anubhav Sinha
SDE-2 @
12 Jun, 2024 @ 01:30 PM

Introduction

Today everyone uses business intelligence solutions to analyze their stored data and wants to make more intelligent and accurate decisions that help them grow. Tableau has emerged as a powerful tool for professionals across industries. Tableau enables users to explore, analyze, and present data visually appealingly. One key component that sets Tableau apart is the Parameters in Tableau

Parameters in Tableau

In this blog, we will understand parameters with the help of Tableau software. We will explore their benefits and discuss how they can help in our data visualization and analysis. So, let's get started.

Introduction to Parameters in Tableau

A parameter in Tableau is a user-defined input that allows you to control and manipulate various aspects of your visualizations dynamically. It enables users to create interactive dashboards and reports. It can be a number, data, or a string that replaces a constant value in a calculation, filter, or reference line.

For example, the user may create a new calculated field that returns True if the quantity of product sold is greater than 100 and otherwise return False. The user can replace the formula's constant value of "100" with a parameter. They can dynamically change the threshold in the calculation using the parameter control.

Now, as we have discussed what parameters are in Tableau, let us learn how to create parameters in Tableau.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Creating a Parameter in Tableau

The following is the procedure to create a parameter in Tableau step by step:

Step 1: Select the Create Parameter option from the drop-down menu on the Data Panel in our Worksheet.

Creating a new Parameter

 

Step 2: Create Parameter window will appear. Please enter a name for the Parameter, and select its data type. A drop-down menu will appear when you try to choose the data type.

Selecting the data type

You can even build a Dynamic Parameter specified to refresh its current value automatically. It will refresh its value when you open your workbook, and Tableau connects to the data source specified by the parameter or when you click the Refresh button.

You can select the Value when the workbook opens option and change its value from Current value to any other according to your requirement.

 

Step 3: You can also select the Display format. You can choose either automatic or specific display formats like a number, percentage, scientific, or custom. Please enter the current value of the parameter also.

Selecting the display format

 

Step 4: Allowable values have three possibilities: All, List, and Range. So you can select all of the values in a field, have a list of values from the field, or specify a range within which you want values in the parameter.

Let's say we want to use the Add value from option to add field values to our parameter. From the choice of fields, we choose the field Sub-category.

The section on the left lists all the values in the Sub-category field. You can delete field values by selecting the field and then clicking the Remove Selected option. Click OK to create the parameter.

Adding the Allowable values

As a result, the newly created parameter "Top Products" appears in the Parameters section in the Data panel. (We Allowed All values in the Top Products parameter shown below)

Shows the created parameter in Data panel

Using Parameters in Tableau

Now that we have learned how to create a parameter in Tableau, let us discuss how to use these parameters in Tableau. The following are the three ways to use a parameter in Tableau.

Using a Parameter as a Filter

Parameters in Tableau lets you dynamically update the value in the Top N filter. We used to manually set the number of values to filter N Top or Bottom entries. You can use a parameter instead of entering the manual data. So, when you want to change the value, you open the parameter control and the filter updates. 

For example, when creating a filter to show the Top 15 product names based on total sales, you can use a parameter instead of the fixed "15" value to quickly update the filter to show the top 10, 20, or 30 product names.

Let us use the Top Products parameter we created in the previous section to filter the Top N sales. In the Top tab, under the By field option, there are drop-down lists with a list of options. Choose the Filter parameter you want to use. In our case, we will select Top Products.

Using the parameter as a filter

Note: To apply a filter to a field, drag the field from the Data panel and drop it to the filter shelf.

 

Right-click on the parameter and select the Show Parameter option. It will show the Parameter Control on the right-hand side.

Show parameter and change its value

 

You can see that the parameter's current value is 1, so only one entry is displayed. You can change the parameter's value and see the Top n entries.

Displays output for parameter value as 20

Using a Parameter in a Calculation

We can also use a parameter in a calculation. Similar to the Top N filter, where we added a parameter to change its value dynamically instead of a constant value, we can also replace a constant value with a parameter. 

For example, the user may create a new calculated field that returns True if the sales sum exceeds 100K and otherwise returns False. The user can replace the formula's constant value of "100K" with a parameter. 

The below image shows the steps. We first select the Create Calculated Field option from the drop-down menu. Then, the calculation box will appear, and enter the formula with the parameter included. In our case, we wrote a formula to filter data for which the sales sum exceeds the value of the Top Products parameter.

Using Parameter in a Calculation

 

Drag the formula from the Data Panel to the filter shelf. Repeat the last step of Using a Parameter as a Filter, i.e., Right-click on the parameter and select the Show Parameter option. It will show the Parameter Control on the right-hand side. You can change the value according to your need.

Using a Parameter in a Reference Line

You can also dynamically change a reference line, band, or box with the help of a parameter in Tableau. 

Click on the Analytics tab. Under the Custom option, double-click on Reference Line to open the Edit Reference Line, Band, or Box dialog box.

Creating a Reference Line

 

The Value drop-down list in the Add Reference Line, Band, or Box dialog box contains a set of parameters. Choose the parameter according to your requirement.

Selecting the parameter in a reference line

Right-click on the parameter and select the Show Parameter option. It will show the Parameter Control on the right-hand side. You can change the value according to your need.

Frequently Asked Questions

What is the purpose of Parameters in Tableau?

The parameter in Tableau lets the user dynamically control and alter various aspects of data visualizations. You can use these parameters as a filter, in calculations, or in a reference line. They provide flexibility enabling users to change specific values on the fly without modifying the underlying data.

Are there any limitations to using parameters in Tableau?

Parameters are unsuitable for large datasets with frequent updates, as changing the parameter values can be computationally intensive. They are also not available for use in some types of calculations. Test and validate the parameters' impact on performance and ensure their accuracy.

What are the types of parameters in Tableau?

Tableau's data types of parameters include Integer, Float, String, Date, DateTime, Boolean, and List. These parameter types allow users to input numerical, text, date, and Boolean values and select options from a predefined list.

Conclusion

We expect this article was insightful and that you learned something new today. In this blog, we learned about Parameters in Tableau. Parameters in Tableau help users to create more dynamic and interactive visualizations, helping in better analysis and decision-making. 

We also learned how to create a parameter in the earlier part of the blog, followed by its uses and implementation in Tableau. Understanding the power and potential of parameters can take your Tableau skills to the next level, enabling you to uncover valuable insights and make data-driven decisions easily.

If you want to learn more about Tableau, do visit.

 

You may refer to our Guided Path on Code Studios for enhancing your skill set on DSACompetitive ProgrammingSystem Design, etc. Check out essential interview questions, practice our available mock tests, look at the interview bundle for interview preparations, and so much more!

Happy Learning, Ninja!

Previous article
Data Types in Tableau
Next article
Dimensions and Measures in Tableau
Live masterclass