KNOWLEDGE BASE

Filter Out top N Percent


Published: 02 Jun 2016
Last Modified Date: 25 Jul 2017

Question

How to filter the top N percent of the data set based on a measure value, for example how to remove the values from the data set that lie above the Nth percentile.

Environment

Tableau Desktop 

Answer

  1. Create a parameter Top N% as a float between 0 and 1, step size 0.01. Optionally, format the display format to 'Percentage'
  2. Create a calculated field 'Top N percent' that returns the n-th percentile value of the data set:
     PERCENTILE([Sales],[Top N%]) 
  3. Create a calculated field 'Top N Filter' that filters out the Top N percent:
  4. [Sales] <= [Top N Percent]
  5. Use the field 'Top N filter' on the Filters shelf, selecting only 'True'.

See attached workbook Top n% sample.twbx for reference.
Did this article resolve the issue?