KNOWLEDGE BASE

Specifying Sort Order of Items in Quick Filters


Published: 11 Jan 2018
Last Modified Date: 02 Jul 2018

Issue

When manually sorting a specific measure in filter, only the items in the view are sorted and the items into the filter list are not sorted. 

Environment

Tableau Desktop

Resolution

While this feature has not been implemented in Tableau at the moment, as workaround the following options may help. These options have been added to a sample workbook and attached to article.
The desired sort in sample workbook for "category" is "a,c,b,d" with "rank" values "1,2,3,4".

Step 1 - Create calculated fields

Create a calculated field that concatenates the sorted measure with filter field which will force the sort:
  1. Select Analysis > Create calculated field
  2. Name the calculated field "_rank_category"
  3. Enter the following formula and click OK
    STR([rank]) +' - ' + [category]

Step 2  - Build the view

Follow the steps below to sort "category" field based on "rank" field:
  1. Add “category” to “Rows” and “amount” to “Text” in Marks
  2. Add “category” to “Filters” and “Show Filter”
  3. Select “Sort” for category” in “Filters and select below:
    1. Sort Order: Ascending
    2. Sort by: Field: rank – Aggregation: Minimum
  4. Add "_rank_category" to filter
This setting sorts the view based on rank value.

Cause

The ability to sort quick filter items by a specific measure is not currently a feature in Tableau Desktop.
 
Did this article resolve the issue?