In the previous articles, we’ve learned how parameters can be used with bins, calculated fields, Table calculations, reference lines and sets. In this last article on application of parameters, we’ll show how parameters can be useful when dealing with disparate data sources.
Assumption: This article assumes that the student here, does not want to involve himself or herself in data shaping & preparation techniques like joining, pivoting data and so on. But, rather would like to explore on the capability of parameters to filter two different data sets.
In this case we would like to devise a way to filter two completely different data sets.
The first data explores the Main roofing type in Kenya, here is the viz;
The second data explores the Main source of lighting energy in Kenya, here is the viz;
Our goal is to use the two views on a single dashboard to show County’s state of roofing & lighting. Without use of parameters, or doing some bit of data shaping the best we could have is the dashboard below.
This view presents one major problem, you must select each filter to adjust the view to a particular County which is unprofessional. Instead, we would like to introduce a parameter to enable us filter across these two data sets.
Create the parameter
Related: How to create a parameter in Tableau.
Note: The list of values has been added from the field ‘County’ of one the two data sets we’re connected to. In case, the field used to create parameter (County for this case) has different members across the two data sets, it’s advisable to add field with (more) complete members to avoid omitting some members.
Add the (All) option
Note: Creating parameter doesn’t add the ‘(All)’ option automatically, we’ll have to scroll to the bottom of our parameter and click ‘Add’ to include the ‘(All)’ option by typing in.
Type in ‘(All)’ and drag it to the top of the list.
Add Calculated fields
Note this calculated field will be added for each data source we’re connected to. Select one of the data sources and create the calculated field ‘County filter’ below.
Add the calculated field to the view as a filter by dragging it to the filter’s shelf. Select filter as ‘True’.
Now, repeat the same process using data on ‘Sources of lighting energy’ to create a ‘County filter’.
Add the above calculated field to the view as a filter and select the filter as ‘True’.
Build the dashboard.
Open a dashboard window.
Drag the two sheets we’ve created to the view.
Make sure our parameter is displayed.
Select different members within the parameter to see the changes.
And there we've it. With the help of a parameter, the challenge of having too many filters can be solved. Instead of having a filter for each data source, we can now use parameter to filter both views from different data sources.
Summarizing use of parameters
In this series of parameters, we’ve learned different ways we can leverage on parameters to bring flexibility in how people consume information dashboards. To mention a few, sets, calculated fields, reference lines, table calculations and bins are some of functions you can use with parameters.
To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.
Thank you for reading.