Module 04 · Building visuals

Filters & parameters

A filter card for readers, and a Top N whose number they can change through a parameter.

Step by step8 minLesson 15 of 21 Free

A filter narrows down the data shown on a sheet. A parameter is a value readers can change, e.g. the number N in "Top N". A parameter filters nothing by itself until a filter or calculation uses it. Start from a copy of the product bar chart: right-click the Revenue by Product tab → Duplicate. Tableau adds a new tab, Revenue by Product (2); double-click it and rename it Top Products.

Illustration of a Tableau worksheet: Region (a grey context filter) and Product on the Filters shelf, the Region filter card on the right with only Jakarta ticked, a Top N parameter control set to 5, the Filter [Product] window on the Top tab, and a bar chart of the top five products in Jakarta. Zoom
A filter card and a Top N parameter drive the same bar chart.

Click a number on the picture or in this list to highlight that area.

Step by step

  1. Step 1: Drag Region from the Data pane to the Filters shelf (number 1). The Filter [Region] window opens on the General tab. Leave every city ticked (if there is a Null, untick it), then click OK.

  2. Step 2: Right-click the Region pill on the Filters shelf → Show Filter. A filter card appears to the right of the view (number 2). Click (All) to clear every tick, then tick Jakarta only.

    Tip: Change the card style with the small arrow at its top-right corner, e.g. Single Value (dropdown) so readers pick just one city.

  3. Step 3: Drag Product to Filters. In the Filter [Product] window, open the Top tab → choose By field. Click the arrow in the number box (it shows 10) → Create a New Parameter.... Set Name to Top N, Data type to Integer, Current value to 5, and Allowable values to Range (Minimum 1, Maximum 12, Step size 1) → OK. Check that the row reads Top, Top N, by Revenue, Sum (if not, pick them from the dropdowns), then click OK.

  4. Step 4: In the Parameters section at the bottom of the Data pane, right-click Top N → Show Parameter. The parameter control appears to the right of the view (number 3); slide or type the number, and the bar chart adjusts immediately (number 4). Finally, right-click the Region pill on the Filters shelf → Add to Context. The pill turns grey and moves to the top.

    Watch out: Without Add to Context, Top N is computed before the Region filter: Tableau takes the national Top 5 first and only then narrows it to Jakarta. A context filter runs first, so the Top 5 is computed for the selected city only.