You can use the rank function to show the top N in the tableau. You can use the following calculation:
RANK(SUM([Sales]))
This calculation has the sort order built-in. So, you can skip the Sort Order step and use this method instead of index() method.
If you want to learn Tableau, check out this Tableau Certification Course by Intellipaat.