Chapter 58. How to Use INDEX() for Easier Top N Filters

With each new field you add to the Filters Shelf in Tableau, you increase the complexity of the view and it becomes increasingly challenging to manage the combination of filters being used. Each filter acts as an AND statement, meaning that all criteria between every filter must be met for the mark to show on the view. To make things trickier, some of the filters can be set to include marks, whereas others can be set to exclude marks. To make things even trickier, you can have measure filters and dimension filters, but the Condition tab in a dimension filter can include measures—what?

Sometimes, you simply want to show the top N (e.g., top 5, top 10) for whatever is left after entering all the criteria. This chapter provides a very quick tip that I sometimes use to make my filters easier to manage and more predictable. This trick has the potential to not only improve the user experience of a view, but also of the authoring experience itself.

How to Create More Predictable, Flexible Top N Filters

To illustrate this tip, consider the following view showing Sales by Customer Name in the Sample – Superstore dataset. The view is currently filtered to show customers in the East region who have spent at least one thousand dollars:

Image

Now, suppose that you want to keep the top three names on the view: Tom, Hunter, and Bill.

Get Innovative Tableau now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.