How to Specify Sort Order of Items in Tableau Quick Filters
Here’s a way to apply a custom sorting logic to a quick filter, beyond the default options of data source order, alphabetical order, and manual sorting.
When you list the three models of the Galaxy S series—Standard, Plus, and Ultra—they will typically appear as shown on the left, regardless of whether you sort by data source order or alphabetically. If you want to set a custom order for the models (e.g., Standard, Plus, Ultra), the two most common methods are:
- Manually sorting each item and making adjustments whenever new data is added.
- Adding a number prefix to each model to define the order.
(e.g., 1. Galaxy S20, 2. Galaxy S20+, 3. Galaxy S20 Ultra)
Aside from these methods, you can also use specific ASCII codes that appear as blank spaces to create a custom sort order logically.
ASCII includes various special characters, and here are the space characters ranked by their ASCII code numbers. If you need fewer than nine sorting levels, you can conveniently use sequential codes from 65520 to 65528.
Here’s how you can use the CHAR function and the ASCII codes mentioned earlier to sort the Galaxy S series:
- Standard: 65520
- Plus: 65521
- Ultra: 65522
In the end, you’ll see the sorting looks like this.
For more details, you can download and review the Tableau file below.