To do this, you'll need to create a nested sort. The following KB should be able to help you get the desired outcome:
Hope this helps!
Let me clarify what Marc wants with the Superstore example.
Row 1: Central Region, Sum Sales of Top N Customers bar
Row 2: Central Region, Sum Sales of Non Top N Customers bar
Row 3: East Region, Sum Sales of Top N Customers bar
Row 4: East Region, Sum Sales of Non Top N Customers bar
Row 5: South Region, Sum Sales of Top N Customers bar
Row 6: South Region, Sum Sales of Non Top N Customers bar
The chart should not show the Customer name. Instead, it shows the sum of top N and sum of non top N.
We have tried to create the formula but could not yet find the answer.
The attached workbook has "Sales by Region and Customer", but no Sum of Top N yet.
SumOfTopN.twbx.zip 1.1 MB
See the attached. How this works is:
1. Use a calculated field to generate the group for the sort instead of a Set. This is used because it can be materialized in the Tableau data source and can be quite a bit faster when there's high cardinality in the data.
2. Use a Top N calc to create the Top N/Non Top N "bins".
3. Create two calculated fields that use the WINDOW_SUM table calc to sum Sales based on membership in each bin.
4. Add the fields to the view, set the Compute Using to the Region+Customer field created in step 1, and filter for non-Null values.
SumOfTopN jtd edit.twbx.zip 1.2 MB
Thank you very much for the answer, that is exactly what we need!
Now I have learned this new technique.