Going into week two, the Data School focused on teaching us about Parameters. This neat function of Tableau allows us to add user defined measures (parameters) to equations and filters.
Creating a dynamic Top N filter with a parameter:
First off, next to Dimensions on the right, select the drop-down menu from the downwards pointing arrow.
Choose the ‘Create a parameter’ Option. This will pop out the parameter creation window. Name the parameter “How many records to filter by?” Set it as an Integer, the rest can be left as it is (It can also to know it can also be set as a range, to limit the amount of choice available to the end user, from 1 to 20 for example).
Drag the selected Dimension (The one you would like to have filtered) filter shelf, and go to the Top tab. Select the by field option, top (this can also be used as a descending filter), and instead of typing in the measure, select the drop down menu and choose the parameter “How many records to filter by?” (As you might be able to see, we can also create the parameter here).
Once this is set you may click ok, select the parameter in the parameter list which is at the bottom left of the tableau interface, just above the data source tab. Right click on it, selecting the show parameter control option.
This will show the parameter in the right-hand side of the worksheet, and allow you to manually filter the number of products (or the measure you chose).
Top N parameters can be very useful in giving power to the user to enable them to answer the questions they may have about the data!