• Bernard

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


In our previous article of this series, we learned how to populate the Top/Bottom 10 profitable customers using sets. In this article, we are going to tackle the same challenge, but now using table calculation rank.

Using Superstores data set packaged with Tableau app, we are going to demonstrate one of the simplest technique which can help a lot. Once connected the data set above.

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

Customers in descending order (Profit)

On the dialogue box that pops up fill it as shown below.

This formula helps us rank profit 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.

Customers in ascending order (Profit)

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

Using the two calculated fields above, we'll categorize them into Top 10 and Bottom 10 profitable customers as shown in the formula below.

Now that we've categorized our 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 at 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 pill and customize your colors. (optional)

See the resulting chart,.

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.

See you in the next article.

Thanks for reading.

#Learningtips