1. Introduction to parameters
Welcome back!
Now that we are familiar with Table calculations, let's study another concept that will allow you to upscale your analysis: the parameters.
2. What are parameters?
Parameters, or in other words, variables, replace constant values in a calculation, filter, or reference line.
You know them very well from basic mathematics classes. In this formula, X and Y are variables, while 2 and 1 are constants. Depending on the value we assign to these variables, the result of the calculation will differ.
In Tableau, parameters can take various data types, for example, a number, date, or a string.
They can be used in calculations, and the users of your reports or visualizations can control the parameter inputs themselves!
This often means you can save a lot of space in your dashboard! Giving the user the possibility of adapting the calculations and visualizations is a great enabler for self-service analytics!
3. Types of parameters in Tableau
In Tableau, we can work with three types of parameters.
The simple text field allows us to type in a free text and can be used, for example, with frequently used product names.
A static list of values is a great option if we want to use existing measures as inputs to our calculations or if we just want to limit the number of filtering options.
The range values parameter is often used with top N types of calculations and can be made very intuitive with a slider look-and-feel experience.
4. Using parameters in calculations
The real power of the parameters in Tableau is the ability to use them in any calculation!
In Tableau, they are marked with purple font and are easily distinguishable from measures and dimensions, as you can see in the example.
Parameters can also remove the need to add new calculations or manually edit the existing ones.
In the example, we use just one calculation and parameter to rule them all.
5. Other uses of parameters
Calculations are not the only use cases of parameters!
Let's have a look at some other practical applications.
Parameters work very well with filters but also with titles of your visualization.
A typical use case would be a Top N calculation based on the parameter input.
As you can see in the example, we can create a neat visualization with an appropriate title with just one parameter!
Another handy practical case is using parameters in the reference lines.
In this example, we define a threshold parameter which later serves as a validation check if our products reach that threshold. Using parameter-based coloring and a reference to the values in the title can immediately upscale your visualization.
6. Making it even more interactive - parameter actions
As you have noticed by now, parameters add a lot of flexibility to a report or a graph. After all, we build dashboards with interactivity and self-service in mind.
With parameter actions, we can take it even a few steps further, allowing the dashboard user to visually change parameters' values by either clicking on them or hovering over data points in the chart.
If you're a designer at heart, you will be thrilled to hear that this feature will enable you to build fully customizable input controls for your parameters.
The possibilities are boundless.
While working with the advanced parameter actions is out of scope for this course on calculations, watch DataCamp for upcoming courses involving this feature.
7. Let's practice!
I am sure you can't wait to get started with the parameters! But first, a small knowledge check.