Bird
Raised Fist0
Tableaubi_tool~15 mins

Parameter for top N control in Tableau - Real Business Scenario

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants a dashboard that shows the top N products by sales, where N can be changed dynamically by the user.
📊 Data: You have sales data with columns: Product Name, Category, Sales Amount, and Order Date.
🎯 Deliverable: Create a Tableau dashboard with a parameter control that lets users select the number N, and a bar chart that shows the top N products by total sales.
Progress0 / 8 steps
Sample Data
Product NameCategorySales AmountOrder Date
Wireless MouseElectronics2502024-01-15
Bluetooth SpeakerElectronics4002024-01-20
Coffee MugHome1502024-01-22
NotebookOffice3002024-01-25
Desk LampOffice3502024-01-28
Water BottleHome2002024-02-01
USB CableElectronics1002024-02-03
Pen SetOffice1802024-02-05
HeadphonesElectronics5002024-02-07
Sticky NotesOffice1202024-02-10
1
Step 1: Connect your sales data to Tableau and load the data source.
No formula needed; just connect the data source with columns: Product Name, Category, Sales Amount, Order Date.
Expected Result
Data source is ready in Tableau with all columns accessible.
2
Step 2: Create a parameter named 'Top N' to control the number of top products shown.
Parameter settings: Name='Top N', Data type=Integer, Current value=5, Allowable values=Range from 1 to 10.
Expected Result
Parameter 'Top N' appears in the Data pane and can be adjusted by the user.
3
Step 3: Create a calculated field named 'Rank by Sales' to rank products by total sales.
RANK_UNIQUE(SUM([Sales Amount]), 'desc')
Expected Result
Calculated field 'Rank by Sales' ranks products from highest to lowest sales.
4
Step 4: Create a filter to show only products with rank less than or equal to the parameter 'Top N'.
[Rank by Sales] <= [Top N]
Expected Result
Filter limits the view to top N products based on the parameter value.
5
Step 5: Build a bar chart with Product Name on Rows and SUM(Sales Amount) on Columns.
Rows: [Product Name], Columns: SUM([Sales Amount])
Expected Result
Bar chart shows total sales for each product.
6
Step 6: Apply the filter created in step 4 to the bar chart to show only top N products.
Use filter '[Rank by Sales] <= [Top N]' on the bar chart worksheet.
Expected Result
Bar chart updates to show only the top N products by sales.
7
Step 7: Add the 'Top N' parameter control to the dashboard for user interaction.
Right-click 'Top N' parameter > Show Parameter Control.
Expected Result
Dashboard includes a control where users can select the number N dynamically.
8
Step 8: Create a dashboard combining the bar chart and the parameter control.
Drag the bar chart worksheet and parameter control onto the dashboard canvas.
Expected Result
Dashboard displays the top N products bar chart with a parameter control to adjust N.
Final Result
Top N Products by Sales Dashboard

[Parameter Control: Top N = 5]

| Product Name      | Sales Amount |
|-------------------|--------------|
| Headphones        | 500          |
| Bluetooth Speaker | 400          |
| Desk Lamp         | 350          |
| Notebook          | 300          |
| Wireless Mouse    | 250          |

Bar chart shows bars descending from Headphones to Wireless Mouse.
✓Headphones have the highest sales amount at 500.
✓The top 5 products contribute significantly to total sales.
✓Users can adjust the number of products shown dynamically using the parameter.
Bonus Challenge

Add a category filter to the dashboard so users can view the top N products within a selected category.

Show Hint
Create a category filter on the dashboard and ensure the 'Rank by Sales' calculation respects the category filter context.

Practice

(1/5)
1. What is the main purpose of using a parameter for top N control in Tableau?
easy
A. To change the color of the top items automatically
B. To let users choose how many top items to display dynamically
C. To permanently fix the number of items shown in a view
D. To sort data alphabetically by default

Solution

  1. Step 1: Understand parameter usage in Tableau

    Parameters allow users to input or select values that can control aspects of the visualization dynamically.
  2. Step 2: Relate parameter to top N control

    Using a parameter for top N lets users decide how many top-ranked items they want to see in the view, making the dashboard interactive.
  3. Final Answer:

    To let users choose how many top items to display dynamically -> Option B
  4. Quick Check:

    Parameter controls item count = C [OK]
Hint: Parameters let users pick numbers dynamically [OK]
Common Mistakes:
  • Thinking parameters fix values permanently
  • Confusing parameters with filters
  • Assuming parameters change colors automatically
2. Which of the following is the correct way to create a parameter for top N control in Tableau?
easy
A. Create a parameter with data type String and list of values
B. Create a filter on the dimension directly
C. Create a parameter with data type Integer and range of values
D. Create a calculated field with fixed value

Solution

  1. Step 1: Identify parameter data type for top N

    Top N control requires a numeric value to specify how many items to show, so Integer type is appropriate.
  2. Step 2: Choose parameter value type

    Using a range of values allows users to select any number within limits, which is ideal for top N control.
  3. Final Answer:

    Create a parameter with data type Integer and range of values -> Option C
  4. Quick Check:

    Integer range parameter = D [OK]
Hint: Top N needs integer parameter with range [OK]
Common Mistakes:
  • Using string type instead of integer
  • Creating calculated fields instead of parameters
  • Applying filters directly without parameter
3. Given a parameter TopN set to 5 and a calculated field Rank defined as RANK_UNIQUE(SUM([Sales])), which filter condition will correctly show the top 5 products by sales?
medium
A. [Rank] <= 5
B. [Rank] > 5
C. [Rank] = 5
D. [Rank] < 5

Solution

  1. Step 1: Understand the rank calculation

    The RANK_UNIQUE(SUM([Sales])) assigns ranks starting at 1 for the highest sales.
  2. Step 2: Apply filter using parameter

    To show top 5, filter where rank is less than or equal to 5, matching the parameter value.
  3. Final Answer:

    [Rank] <= 5 -> Option A
  4. Quick Check:

    Rank ≤ TopN = A [OK]
Hint: Filter ranks ≤ parameter value for top N [OK]
Common Mistakes:
  • Using rank > 5 which shows bottom items
  • Using rank = 5 which shows only one item
  • Using rank < 5 which excludes the 5th item
4. You created a parameter TopN and a calculated field Rank = RANK_UNIQUE(SUM([Profit])). You apply a filter [Rank] <= [TopN] but the dashboard shows no data. What is the most likely issue?
medium
A. The parameter TopN is not added to the view or set to a valid value
B. The calculated field syntax is incorrect
C. The filter should use [Rank] >= [TopN] instead
D. The data source does not contain the Profit field

Solution

  1. Step 1: Check parameter usage

    If the parameter is not added to the view or has no value selected, the filter condition cannot evaluate properly, causing no data to show.
  2. Step 2: Verify filter logic

    The filter [Rank] <= [TopN] is correct for top N control, so syntax is not the issue.
  3. Final Answer:

    The parameter TopN is not added to the view or set to a valid value -> Option A
  4. Quick Check:

    Parameter must be active and valid = B [OK]
Hint: Always add and set parameter value before filtering [OK]
Common Mistakes:
  • Using wrong filter comparison operator
  • Not adding parameter control to dashboard
  • Assuming calculated field syntax is wrong without checking
5. You want to create a dashboard where users can select the top N customers by sales, but also filter by region. Which approach correctly combines parameter for top N control with a region filter?
hard
A. Use only a region filter and sort customers manually
B. Create a parameter TopN and use it as a filter on region directly
C. Create a calculated field for region rank and ignore the parameter
D. Create a parameter TopN, a calculated field Rank = RANK_UNIQUE(SUM([Sales])), filter [Rank] <= [TopN], and add a region filter on the dashboard

Solution

  1. Step 1: Use parameter and rank for top N customers

    Create a parameter to let users pick N, and a rank calculated field based on sales to rank customers.
  2. Step 2: Apply filter and region filter separately

    Filter customers where rank ≤ parameter value, and also apply a region filter to limit data by selected region.
  3. Step 3: Combine both filters on dashboard

    Add both controls so users can select top N and region independently, enabling flexible analysis.
  4. Final Answer:

    Create a parameter TopN, a calculated field Rank = RANK_UNIQUE(SUM([Sales])), filter [Rank] <= [TopN], and add a region filter on the dashboard -> Option D
  5. Quick Check:

    Parameter + rank + region filter combined = A [OK]
Hint: Combine parameter rank filter with separate region filter [OK]
Common Mistakes:
  • Using parameter to filter region directly
  • Ignoring region filter when applying top N
  • Not combining filters properly on dashboard