Here are the steps to show the top 5 and bottom 5 in tableau:
1. Create a calculated field with the calculation as follows:
RANK( SUM( [Sales] ), 'desc' ) <= [N Parameter]
RANK( SUM( [Sales] ), 'asc' ) <= [N Parameter]
The above calculation returns a TRUE only if SUM( [Sales] ) is the highest N ranking sub-categories for either top N or bottom N .
2. Drag the newly created field to the Filters shelf. Click OK to close the Filter dialog.
3. Right-click the newly created field on the Filters shelf. Select Compute using > Pane (Down).
4. In the Filter dialog, check True. Click OK.
If you want to learn Tableau, check out this Tableau Training Course by Intellipaat.