A parameter gives the user the ability to explore the data by narrowing the view down to certain values, depending on what they want to look at. This allows the user to decide what part of the data is most important to them, and focus more in depth on that. You can use more than one parameter on a sheet if you want the user to be able to dig deeper into the data.
We will use two parameters today. One to control the Signature Group, and another to choose the Top N values.
Step 1 | Create Parameter
Either, using the drop down, or by right clicking anywhere in the Data Pane, click 'Create a Parameter'.
Give your parameter a name. In this case, ‘Amount of Signatures’.
Choose your Data Type: When choosing your data type, you are choosing what sort of value the user will be exploring. In this case, the user will be choosing between a number group, so we will choose ‘Integer’.
Then go to Allowable Values and choose ‘List’ as we want to create a list of each signature group. Then create your groups.
In the ‘List of Values’, ‘Value’ is how you want to refer to it in your calculation. It can be a shortened version of the ‘Display As’ group, so you have less to type into your calculation later. Think of it as a nickname.
‘Display As’ is how it will be displayed in the drop down as you are exploring the parameter. You have the ability to change what you want it to be displayed as by double clicking and re-typing as you wish.
Current Value: This will usually show up automatically as the first value in your list of values, for this example, we don’t need to change this.
Now you have your parameter, it will show up at the bottom of your data pane. Right click on your parameter and choose ‘Show Parameter’. This will show the parameter on the right hand side of your chart.
At this point, your parameter is visible, but it not connected to your visualisation. It is important to remember that for a parameter to work, it has to be connected to your chart with a calculation.
Step 2 | Create a Calculation
Either using the drop down, or by right clicking anywhere in the Data Pane, click ‘Create a Calculated Field’.
Name your calculation in a way that makes sense to you. In this case we will name it Group Parameter Calc. Enter the following CASE Statement:
Parameters will always show up in purple in calculations. This makes it easy to recognise if you have input the correct field in your calculation.
Drag your calculation to the Filter shelf and choose ‘True’. Also drag your calculation onto the Columns shelf.
STEP 3 |Following the same steps, create your second parameter:
For this particular data set, in order for the parameter to work, I had to create a rank calculation to help order the Constituency's in the way I wanted. The calculation is: RANK_UNIQUE(SUM([Signature Count])).
With this calculation, you can then create the calculation for the parameter as follows:
Drag the calculation onto the filter shelf. Right click, edit table calculation. Compute using 'Table (down)'. In specific dimensions choose 'Constituency, Group Parameter Calc, Signature Count'.
Click the X to come out, then right click again on the Rank Filter and Edit Filter. Make sure to uncheck 'False', otherwise the parameter will not work as it will show you all values as oppose to the Top N.
Now you are ready to explore your data!
If you would like to view this Viz and have a go at creating parameters with this data source, click on the link: https://public.tableau.com/views/PetitiontoPermitLargerWeddings/Petition?:language=en&:display_count=y&:origin=viz_share_link