A quick guide to Parameters


 

A parameter is a user-generated list of values which may or may not be present in the original dataset.

The first time I built one, I could not understand their functioning. In fact, if you only create a parameter, all you get is a dropdown of values which do not affect anything in the view.

In order to utilise a parameter in your view you need to follow these 4 steps:

  • Create a parameter

Here is possible to select the data type and the values to display. Those value can be part of a user-generated list or be set using a specific field.

  • Show parameter control

Right-clicking on the new parameter will display the control options on the right-hand side of the view. Up to this step, the parameter is still unfunctional.

  • Create a calculated field that uses the parameter

This is the focal step of this process. Utilising the parameter field inside a calculated field allows the parameter control to affect the view. The most common types of calculated fields using parameters are IF and CASE statement.

  • Use the field

This may sound obvious, but if the calculated field is not part of the view (rows, column or marks card) it won’t affect the visualisation.


Here you can see an example of a visualisation I created that uses a parameter to select a specific metric.

This viz uses a dataset which recorded every taxi journey in New York City from 2009 to 2016. The parameter allows to select which metric to display, number of journeys, average fare or median distance.

myctaxi

https://public.tableau.com/views/NYCTaxiesDS13DashboardProjectWeek2/NYCTaxis?:embed=y&:display_count=yes

To do so I created a parameter using these settings

PARAMcfield

I then created a CASE calculated field, which you can see in the picture below

PARAMcfield2

Finally, I applied this calculated field in all different views that composed the dashboard, on the colour shelf for the heatmap and in the rows shelf for the other views.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: