Lead magnet - project 1.png

Tableau Tips: Top/Bottom N members (Index(),Size(),Integer)

Updated: Nov 7


top and bottom n in Tableau

In the previous two articles ( article 1 & article 2 ) of this series, we learned how to compute the Top/Bottom 10 profitable customers using sets and table calculation rank respectively. In this article, we are going to tackle the same challenge but now using an integer and table calculation Index() and Size() .

Using superstores data set packaged with Tableau app, lets populate the Top/Bottom 10 profitable customers. Once connected to the data set above,..

Create calculated field - Index

  • Right click anywhere under dimension or measure area and select >> Create >> Calculated Field,..

  • On the calculation editor input INDEX()

Tableau calculated field INDEX

Create calculated field - Size

  • Repeat the same procedure above to create the field Size as shown below.

Tableau calculated field SIZE

Lets create a formula that will enable us select the Top/Bottom 10 profitable customers using the calculated field Index, Size and integer 10 as shown below.

Tableau calculated field

Lets build our chart.

  • Drag dimension Customer Name to the Rows shelf.

  • Drag measure Profit to the Columns shelf. (Note Profit is aggregated by SUM(), you can correct this if your default aggregation is different)

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

  • Drag the field 'Top/Bottom 10 profitable customers' above to the filter and select 'Top 10 profitable customers' and 'Bottom 10 profitable customers' respectively.

  • Drag 'Top/Bottom 10 profitable customers' to the color shelf and chose your preferred color. (optional)

See the resulting chart below.

Top and bottom n members of a dimension in Tableau

Note that our final result is exactly like in the previous two articles. I hope one of the technique will be much helpful in your daily tasks as an analyst.

To receive more of these Tableau tips and tricks, subscribe to our mailing list 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!

#Learningtips

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!