top of page

Tableau Tips: Parameters - Sets

Updated: Aug 18, 2021


Tableau parameters with sets

In one of the previous article on Tableau tips, we explored different ways to select the top & bottom N members of a dimension. One of the articles clearly explored how we could use parameter to show top/bottom N members. As you’ll note from that previous article, our parameter consisted of a single value and therefore not as dynamic as the end user would like.

Therefore, in this article we would like to add some flexibility in selecting the value N, with parameters we would like to empower the end user with a variety of choice to choose from.

Our problem

In this hypothetical case we assume the positions of analytics consultants at Superstores, where the product manager has requested we populate a list of top/bottom 10 Profitable products in South region. And as a smart analyst, I know my manager is unpredictable and therefore his demands may change by the time the assignment is through, I’m also privileged to be using a tool that allows myself to be prepared in responding to the unexpected twist of questions.

Solution

With the help of parameters, I will create an interface where my manager has the choice of deciding what the value N is, on top of that, using filters I would like to enable my manager to decide which region will be of interest to him, not just ‘South’ region like proposed at the beginning of the assignment.

Building the solutions

Using Superstores data set pre-packaged in Tableau.

Create a parameter first

Right click on any field on the data pane window and select >> Create >> Parameter…

On the pop-up menu, rename the parameter as ‘Top/Bottom N’ and input other details as shown below.

Create Top N set

Right click on dimension field ‘Product Name’ and select >> Create >> Set…

Rename it ‘Top N’ and input other details as shown below.

Create Bottom N set

Replicate the step above to select the bottom set.

Note: The only difference here is, we’ve selected ‘Bottom’ under 'By field':

Create a combined set

Right click on one of the sets we’ve created and select ‘Create Combined Set…

Rename it, ‘Top/Bottom N set’ and fill as shown below.

Now, let’s build our viz;

  • Drag dimension field ‘Product Name’ to the rows shelf.

  • Drag measure field ‘Profit’ to the columns shelf.

  • Sort in descending order.

  • Drag our combined set ‘Top/Bottom N set’ to the filters shelf.

  • Drag the dimension field ‘Region’ to the filters shelf and select ‘South’ region.

Important: We need to convert the filter ‘Region’ into a context filter, so it can be computed before the sets. To do so, right click on the field in the filter box and select ‘Add to Context’, note the background color of the field turns grey.

  • Drag either ‘Top N’ or ‘Bottom N’ set to the color shelf and change color appropriately to show the difference.

  • Show parameter control.

With this view, the manager Superstores now has the freedom to decide which data is of priority. He can choose the value N and even change Region of view as he wishes.

What next?

In the next article on application of parameters, we’re going to learn how parameters can be used with Table calculations.

Stay tuned, to explore the fifth use case of Parameters.

You can revisit the previous use cases of parameters with, bins, calculated fields and reference lines to learn more.

To receive more of Tableau tips and tricks, kindly join our mailing list by subscribing below.

Thank you for reading.


Blog.png
bottom of page