How to Create a Top N set That Retains Global Percentage of Total Values in Tableau
Description
In this silent video you’ll learn how to create a view in Tableau that shows the Top N of a dimension and classes the rest into the 'Other' group, while dynamically adjusting to filtering out dimension members and at the same time retaining global totals.
Read the full article here: Creating a Top N set That Retains Global % of Total Values — https://kb.tableau.com/articles/howto/creating-a-top-n-set-that-retains-global-of-total-values
- - - - - - - - - - - - - -
Step 1: Create a Parameter
1. In the Data window, click the drop-down arrow at the top right of Dimensions, and then select Create and then Parameter.
2. In the Create Parameter dialog box, name the parameter. In the example workbook, the parameter is named Top N.
3. Under Data Type, select Integer.
4. Under Current Value, add "5".
5. Click OK.
Step 2: Create 4 new calculated fields
View the KB article for details about all 4 calculated field formulas
Step 3: Build the view
1. Create a pie chart by selecting the Pie icon in the Marks card
2. Drag 'Top N set' on Color and Label.
3. Drag Sub-Category on Detail.
4. Drag 'Sales (cheat)' on Angle and Label.
1. To configure this field in Percentage, right-click it in the Marks card and select Format...
2. In the Numbers section, click the numbers and select Percentage.
3. (Optional) Adjust the number of decimal places as desired.
5. Drag '% of total (cheat)' on Label.
6. Set all table calculation fields along 'Sub-Category'.
7. Use the filter "Hide Duplicates" along 'Sub-Category' and filter on the 'True' value.
8. Drag Sub-Category to the Filter shelf and select All
9. Then right-click this Sub-category field and select Sort...
1. In Sort by... select "Field"
2. Choose to sort by Descending order
3. In the Field Name, select Sales.
4. Close the Sort pop-up window
Related solutions:
Finding the Top N Within a Category - https://kb.tableau.com/articles/howto/finding-the-top-n-within-a-category
Create Sets for Top N and Others - https://help.tableau.com/current/pro/desktop/en-us/sortgroup_sets_topn.htm
- - - - - - - - - - - - - -
Subscribe to the Tableau YouTube channel here: http://www.youtube.com/subscription_center?add_user=tableausoftware
Free Trial of Tableau: link: https://www.tableau.com/products/trial
Comments