Try to follow these steps:
Step 1:Create a calculated field named index and type index()
Step 2: Place the name field and calculated field into the row shelf
Step 3: click on the name and sort it in descending order via the field
Step 4:with integer data type creates a parameter TOP N
Step 5: Create a calculated field called TOP N and enter this formula
if [Index]<=[Top N] THEN "Top N" ELSE IF [Index]>=SIZE()-[Top N] THEN "Bottom n" END
Step 6: Drag top 10 into the filter and select top n and bottom n
Step 7: Drag the new calculation into the rows
If you want to learn more about it Tableau, then go through this Tableau Training for more insights.