上次修改日期 : 17 Oct 2022
環境
Tableau Desktop解決方法
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.
原因
The multiple Top N filters are executed together with the AND logical operator.其他資訊
For more information about this topic, see the following pages:感謝您針對本文的效益提供意見回饋。
開啟新案例
繼續搜尋
知識庫
社群
產品說明
訓練及教學課程