All IT Courses 50% Off
Tableau Tutorials

Tableau Parameters

Parameters are mostly useful when you want to add interactivity and flexibility to a report or experiment with what-if scenarios. Suppose you are unsure about which fields to include in your view or which layout would work best for your viewers. You can then incorporate parameters into your view to let viewers choose how they want to look at the data.

Before beginning, decide which fields you want to make interactive. For example, you can allow users to view the categories within a dimension by color, view sales data over a period they choose, etc. The example described below sets up a table for which users could select the dimensions to display in the columns and rows.

How to Create Parameters?

The below steps use the Superstore sample to create new parameters.

Step 1: In the Data pane, click the drop-down arrow in the upper right corner and select Create Parameter.

Step 2: In the Create Parameter dialog box, perform the following steps:

  1. Name the parameter so that the viewers can tell what changes it will do. This example is using Select Column 1 Heading.
  2. For Data type, select option String.
  3. For Allowable Values, select option List, type None as the first value in the list and then press Enter.
  4. Complete the list by typing the additional dimension fields’ names that you want to expose through the parameter.

The Display As aliases defaults the field name, and for this step, you can leave them as they are.

https://help.tableau.com/current/pro/desktop/en-us/Img/change-view-parameters-DPV.png
  1. Click OK to return to the dialog box Calculated Field.

Step 3: Repeat the previous step to create the following additional parameters:

  • Select Column 2 Heading
  • Select Row 1 Heading
  • Select Row 2 Heading

Create the calculated fields:

The below steps use the Superstore sample to build the calculated fields to take advantage of your parameters.

Step 1: In the Data pane, click the drop-down arrow in the upper right corner and select Create Calculated Field.

Step 2: In the dialog box, Calculated Field, for Name, type Column 1 Category.

Step 3: In the Calculated Field dialog box, for Formula, add the following calculation:

CASE [Select Column 1 Heading]
WHEN 'Customer Name' THEN [Customer Name]
WHEN 'Customer Segment' THEN [Customer Segment]
WHEN 'Region' THEN [Region]
WHEN 'Department' THEN [Department]
WHEN 'Category' THEN [Category]
ELSE ''
END
https://help.tableau.com/current/pro/desktop/en-us/Img/change-views-parameters2.png

Confirm that the status message represents that the formula is valid, and then click on OK.

Step 4: Create three more calculated fields, one for each of the additional parameters you created:

Tableau Parameters

The basic formula for the calculated field is the same as done in the previous step, except you refer to a different parameter in each CASE statement.

How to allow viewers to interact with views?

Next, expose the parameter control so that the users can select the categories they want to display.

Step 1: For each parameter, you have created, do the following:

Under Parameters, right-click on the parameter and select Show Parameter Control.

https://help.tableau.com/current/pro/desktop/en-us/Img/change-views-parameters4.png

Step 2: From the Data pane, drag the calculated fields you created to the Columns and Rows shelves.

Step 3: From the Data pane, drag a measure to the view. In this example, Sales are placed on Label on the Marks card.

Step 4: Test your parameters by selecting the fields in the parameter controls.

Tips:

  • Sort the dynamic dimension fields in alphabetical order.
  • Hide the field labels for rows and columns.
https://help.tableau.com/current/pro/desktop/en-us/Img/change-views-parameters5.png

Step 5: Reset all parameters to None and publish the workbook to Tableau Server.

https://help.tableau.com/current/pro/desktop/en-us/Img/change-views-parameters6.png

Viewers can set up their reports, save their parameter settings, and share views with others.

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button
H2kinfosys Free Demo Online Training