Sorting is Wrong When Using Dimension Filter and TOP N Filter Together in Tableau Desktop.
Published: 22 Feb 2023 Last Modified Date: 23 Feb 2023
When using the TOP N filter and a Dimension filter together, the sorting can be different than expected.
Changing the Dimension filter to a Context filter can solve this problem. See the attached workbook to follow along with the steps below.
The following procedure shows how to filter Sales by Customer Name and by Category and then display only the top 10 customers, making one of the Dimension filters a Context filter.
Create a bar chart.
1. Connect to Sample Superstore in Tableau Desktop. 2. Drag Customer Name to Columns and Sales to Rows. 3. Drag Category to the Filters pane and select only "Furniture". 4. Right-click on Category on the Filters shelf and select Show Filter. 5. Drag Customer Name to the Filters pane and set the Top 10 filter as follows:
6. Right-click on Customer Name on the Filters pane then select Sort > Set as follows:
Apply the Context filter.
7. Right-click on Category on the Filters pane and select Add to Context.
Tableau's order of operations processes the Top N filter before the Dimension filter.