Tableau Quick Tip: Top N and Bottom N Filters

Data

Tableau Quick Tip: Top N and Bottom N Filters

For anyone attending a Tableau training on the second day, we will often teach how to create a Top N filter. This is a very commonly used tip by Tableau authors. Often the analysis asks us to filter the data by the top performers and to allow our end users to decide which N they want to see.

Top N in Tableau

Sometimes, though, we will want to give the end users some extra flexibility. Instead of seeing just the top performers, we want to also allow them to select the bottom ones.

To do that, we just need to follow three steps:

  • Create a String parameter allowing the end user to select Top or Bottom
  • Create a calculation like the one below
  • Add the calculated field to the Filter shelf and set it to True

Top and Bottom Calculation in Tableau

What the calculation does is to look for the Top/Bottom parameter, and if it is the Top, then a Boolean field will show true for all the all the values equal or lower than the number in the Top N. (-Sales) inverts the values and therefore filters for the top values, considering that we are now looking at negative values.

In the view, however, we keep the Sales and not the negative values.

Final view in Tableau

This is a very quick tip that I hope you find useful. You can see how it works in the actual Tableau dashboard below. Thank you for reading.

More About the Author

David Pires

Senior Analytics Consultant
Tableau Quick Tip: Top N and Bottom N Filters For anyone attending a Tableau training on the second day, we will often teach how to create a Top N filter. This is a very commonly ...
Tableau Releases Hyper in Version 10.5 TL;DR: Hyper is much faster at extracting data. Like, so fast. Not many Tableau releases have had the size and expectations surrounding ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK