To improve the user experience in Tableau by avoiding a scroll bar, you can implement a solution where users can select the number of bars to display, and the rest are grouped into an "Others" category. Here's a step-by-step guide to achieve this:
Step 1: Create a Control Parameter
- Go to the Data pane, right-click, and select
Create Parameter
. - Name the parameter, for example,
Top N PM
. - Set the Data type to
Integer
. - Allowable values should be set to
Range
, and define a minimum and maximum value. The current value can be set to a default, such as 20.
![](https://www.thedataschool.co.uk/content/images/2024/06/Screenshot-2024-06-06-121411.png)
Step 2: Create a Top N set
- In the Data pane, right-click your dimension (e.g.,
State
) and selectCreate Set
. - Name the set, for example,
Top N PN
. - In the Edit Set dialog box, choose the
Top
tab. - Select
By field: Top [N] by [Your Measure]
.
![](https://www.thedataschool.co.uk/content/images/2024/06/Screenshot-2024-06-06-121438.png)
Step 3: Create 'Other' Calculation
- Right-click in the Data pane and select
Create Calculated Field
. - Name this field, for example,
Category with Others
. - Use the following formula:
IF [Top N Set] THEN [State/Province] ELSE 'Other' END
![](https://www.thedataschool.co.uk/content/images/2024/06/Screenshot-2024-06-06-120341.png)
Final Touches
- Customize the visualization by adjusting colors, labels, and tooltips as desired.
- Ensure the parameter control is user-friendly, perhaps by adding a clear title or instructions.
- To ensure the "Others" category appears at the end of the visualization by adding the set to the row before the calculated field for "Others,
![](https://www.thedataschool.co.uk/content/images/2024/06/Screenshot-2024-06-06-123426.png)