Data dell'ultima modifica: 17 Oct 2022
Ambiente
Tableau DesktopSoluzione
To control the order in which the Top N filters are executed, you can make use of:- Context filters
- Level of detail expressions
- Table calculations
Step 1: Create the View
- Place Region, Category and Sub-Category on Rows
- Place SUM(Sales) on Text
- Select Analysis > Create Calculated Field. Name the field Rank of Sales, enter the following calculation, then click OK:
RANK( SUM( [Sales] ) )
- Select Analysis > Create Calculated Field. Name the field Rank of Sales excluding Sub-Category, enter the following calculation, then click OK:
RANK_DENSE( SUM( { EXCLUDE [Sub-Category] : SUM( [Sales] ) } ) )
Step 3: Set up Filters
- Drag Rank of Sales excluding Sub-Category to Filters and click OK.
- Right-click Rank of Sales excluding Sub-Category on Filters and select Edit Table Calculation…
- In the Table Calculation dialog, select Compute Using > Specific Dimensions.
- Arrange Region, Category and Sub-Category in descending order, then select the check boxes next to all three fields.
- Under Restarting every, select Region.
- Right-click Rank of Sales Excluding Sub Category on the Filters shelf and select Edit Filter...
- In the Filter dialog, enter the desired limits. For example, enter a range of 1 to 2 to display the top two Categories in each Region.
- Drag Rank of Sales to Filters, and click OK.
- Right-click Rank of Sales on Filters and select Edit Table Calculation…
- In the Table Calculation dialog, select Compute Using > Specific Dimensions.
- Arrange Region, Category and Sub-Category in descending order, then select the check boxes next to all three fields.
- Under Restarting every, select Category.
- Right-click Rank of Sales on Filters, and select Edit Filter.
- Enter the desired limits.
Causa
The multiple Top N filters are executed together with the AND logical operator.Ulteriori informazioni
For more information about this topic, see the following pages:Grazie per aver inviato il tuo feedback sull'efficacia dell'articolo.
Apri nuovo caso
Continua la ricerca
Knowledge base
Community
Guida
Formazione e tutorial