During week one of training at The Data School, we spent most of our time learning about the best practices for dashboard design and familiarizing ourselves with the Tableau environment. We also learnt how to select the right chart based on our data, connect to different data sources, and the different types of filters and sorts used, but a concept that I enjoyed learning from week one was parameters.

What are parameters?

Parameters are dynamic values that allow users to manipulate the behavior of a dashboard or a worksheet. They are user-defined values that can replace constant values in calculations, filters, and reference lines. They can be used in calculations and referenced in different parts of a dashboard. Parameters improve the interactivity and flexibility of a dashboard.

Walk-through example of a parameter use-case

Below, we will look at an example where we will be using the Sample-Superstore dataset to look at the profit of different product sub-categories in the US. For this, we will create two parameters. Using the first parameter, we will create horizontal radio buttons which will filter the view based on the dimension – ‘Region’ and the other parameter will display the ‘Top Sub-Categories by Profit’ based on a user-defined value.

Parameter 1: Selected Region Parameter

  1. After connecting to the Sample-Superstore dataset, drag the Orders table into the canvas and open a New Worksheet and rename it as Radio Button.
  2. Create a new parameter called Selected Region Parameter with Data type – String and select Region from the Add values from dropdown.
  3. Next, we will create a calculated field called Radio Button with this calculation: STR([Selected Region Parameter]=[Region])+[Region]. This calculation will return a concatenated value of a Boolean and the region name.
  4. Drag the Region dimension into the Columns shelf and select Shape from the Marks dropdown menu. After changing the mark type, drag the Radio Button dimension into Shape.
  5. Right-click on Selected Region Parameter and select Show Parameter.
  6. Format the Shapes where all the True values (t) are displayed as ◉ and False values (f) are displayed as ◎. Repeat this step for all values of the Selected Region Parameter.
  7. Right-click on Region and select Hide Field Labels for Columns. Right-click on the header and uncheck Show Header, and change view from Standard to Entire View.
  8. Next, we will drag Region into Label and format the size of the buttons and remove the row-dividers to achieve the below output. 
    Then, we will create the following calculated fields for the different regions:

    • Central: IF [Region]=’Central’ THEN [Profit] END
    • East: IF [Region]=’East’ THEN [Profit] END
    • South: IF [Region]=’South’ THEN [Profit] END
    • West: IF [Region]=’West’ THEN [Profit] END
    • Value: CASE [Selected Region Parameter] WHEN “Central” THEN [Central] WHEN “East” THEN [East] WHEN “West” THEN [West] WHEN “South” THEN [South] END
  9. Create a new sheet called Profit by Sub-category and drag the Value measure into the Columns shelf and the Sub-category dimension into the Rows shelf.
  10. Drag Region into the Color and sort the data by descending sum of Value within Sub-category.

Parameter 2: Top N Parameter

  1. To create the second parameter, right-click on Sub-category pill and select the Filter option.
  2. Go to the Top tab and select the By field option. Select the Create a New Parameter option from the drop-down menu.
  3. Rename the parameter to Top N Parameter with Data type – Integer and select the All option under Allowable values.
  4. Right-click on Top N Parameter and select Show Parameter.

Building the dashboard

  1. Open a New Dashboard and drag the two sheets onto the dashboard canvas.
  2. After dragging the sheets in, we need to make certain changes such as:
    • Hide all the titles, null value indicator and Selected Region parameter.
    • Remove all legends from the dashboard.
    • Change the Top N Parameter to a floating object.
    • Rename the axis-title of Value to Profit.
  3. Next, we need to create a dashboard action filter called Region filter to add interactivity to the dashboard.
  4. Set the fields with the same values as below:
  5. Finally, we have an interactive dashboard using which we can filter Profit by different regions.

In conclusion, parameters are a powerful feature in Tableau that can help users can help users gain deeper insights and make better-informed decisions.

 

Icon attribute: <a href="https://storyset.com/work">Work illustrations by Storyset</a>
The Data School
Author: The Data School