Tableau Tips: Top/Bottom N members (Index(),Size(),Integer)
Updated: May 17
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() .
Create calculated field - Index
Right click anywhere under dimension or measure area and select >> Create >> Calculated Field,..
On the calculation editor input INDEX()
Create calculated field - Size
Repeat the same procedure above to create the field Size as shown below.
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.
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.
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.
Thank you for reading.