top of page

Tableau Tips: Top/Bottom N members (use of table calculation- Rank)

Updated: Nov 7, 2022

top and bottom n members of a dimension in Tableau

In the previous article of this series, I showed you how to populate the Top/Bottom 10 profitable customers using sets. In this article, I will show you another technique to tackle the same challenge, but now using table calculation rank.

I will be using Superstores data set pre-packaged with Tableau app

Once you've connected to the data set above.

Right click any where under dimension or measure area and select Create >> Calculated field.

Rank customers in descending order ( by Profit)

On the calculation editor fill it as shown below.

This formula helps us rank customers in descending order by Profit.

Tableau table calculation ranking customers in descending order

Note: Above calculation does not specified how our ranking is being computed, to set the computation to rank profit a long the Customer Name, select Default Table Calculation above and chose compute using Customer Name.

Rank customers in ascending order ( by Profit)

Repeat the above process to rank Profit in ascending order along Customer Name.

Tableau table calculation ranking customers in ascending order

Using the two calculated fields above, I'll categorize them into Top 10 and Bottom 10 profitable customers using the formula below.

Tableau calculated field

Now that I've categorized my computation above, lets build our chart.

  • Drag Customer Name from the dimension field to the Row shelf.

  • Drag profit from the measure field to the Column shelf.

  • Sort the chart in descending order by clicking on the sort icon on the tool bar.

  • Drag the calculated field Top/Bottom 10 profitable customers to the Filters and choose 'Top 10 profitable customers' and 'Bottom 10 profitable customers'

  • Drag Top/Bottom 10 profitable customers again to the color shelf and customize your colors. (optional)

See the resulting chart,.

top and bottom n members of a dimension in tableau

Comparing the resulting chart above from our previous example, you can concur with me that the results are the same. I hope one of the technique will be helpful to you.

To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.

If you like the work we do and would like to work with us, drop us an email on our Contacts page and we’ll reach out!

Thank you for reading!

Black & white.jpg

About Me

More About the Author

Bernard K

Analytics Consultant | 3X Tableau Certified

Bernard is a data analytics consultant helping businesses reveal the true power of their data and bring clarity to their reporting dashboards. He loves building things and sharing knowledge on how to build dashboards that drive better outcomes.

Let’s discuss your data challenges! Let’s work together!

bottom of page