Unexpected Results when using Top N Filter with Other Filter

Published: 22 Feb 2013
Last Modified Date: 13 Apr 2017


When you apply a Top N filter to a view that uses a second filter, the updated view does not produce the expected Top N result.


Tableau Desktop


Option 1: Add the Filter Field to Context

  • On the Filters shelf, right-click the field being used to filter the view, and then select  Add to Context. For more information, see Creating Context Filters in Tableau Help.

Option 2: Use Index() and a Table Calculation

Option 3: Filter Using a Calculated Field

  1. Right-click a blank area in the Data window and select Create Parameter.
  2. Name the parameter Filter Parameter.
  3. Add data from the field being used to filter the view to the parameter.
  4. Select Analysis > Create Calculated Field.
  5. Name the field and add the following calculation to the Formula field:
    IF ([<field>] = [Filter Parameter])
    THEN [<measure>]
    ELSE 0
  6. Replace the measure in the view with the new calculated field.


The Top N sort is calculated before looking at the field on the Filters shelf.
Did this article resolve the issue?