筛选数据

  • 版本 :2022.1 及更高版本

注意:从版本 2020.4.1 开始,您现在可以在 Tableau Server 和 Tableau Online 中创建和编辑流。除非特别说明,否则本主题中的内容适用于所有平台。有关在 Web 上创作流程的详细信息,请参阅Tableau Server(链接在新窗口中打开)和Tableau Online(链接在新窗口中打开)帮助。

Tableau Prep 提供了可用于筛选数据的各种选项。例如,使用“仅保留”或“排除”对配置文件卡、数据网格或结果卡中字段的特定值执行一键式筛选,或者从各种筛选器选项中进行选择以满足更复杂的筛选需求。您还可以保留或删除整个字段。

在流中的任何步骤筛选数据。如果只想更改特定值,可以选择“编辑值”以内联编辑值或将值替换为 Null。有关编辑字段值的详细信息,请参阅编辑字段值(链接在新窗口中打开).

保留或删除字段

在流程中处理数据时,可能需要删除不需要的字段。在任何清理或操作步骤的“配置”窗格或数据网格中,选择一个或多个字段,然后右键单击或按住 Ctrl 键单击 (MacOS)并选择“删除”以删除所选字段,或选择“仅保留”(Tableau Prep Builder 版本 2019.2.2 及更高版本以及 Web 上)以仅保留所选字段并删除所有未选择的字段。

隐藏字段

从版本 2021.1 开始,Tableau Prep Builder 版本 2021.1.4 及更高版本以及 Tableau Server 或 Tableau Online 中受支持。

如果流中有不需要清理的字段,但仍希望将它们包含在流中,则可以隐藏这些字段,而不是将其删除。在取消隐藏字段或运行流以生成输出之前,不会加载这些字段的数据。

隐藏字段时,名为“隐藏字段”的新配置文件卡会自动添加到“配置文件”窗格中,使您可以根据需要轻松地从列表中取消隐藏字段。

您可以在大多数操作中包括隐藏字段,但联接、聚合和透视需要取消隐藏字段才能在其中一个步骤类型中使用它。如果在这些操作之一中使用该字段后将其隐藏,则该字段将显示为隐藏,并且该操作不会受到影响。

所有隐藏字段都标有眼睛图标。

隐藏和取消隐藏字段

若要隐藏或取消隐藏字段,必须位于“输入”步骤或“清理”步骤中。在“清理”步骤中,可以隐藏或取消隐藏“配置”窗格、日期网格和列表视图中的字段。

从输入步骤

  1. 连接到您的数据。

  2. 在“输入”步骤中,选择要隐藏或取消隐藏的字段。

  3. 单击眼睛图标可隐藏或取消隐藏字段。

    当前不支持输入步骤中的多选字段。

From the Profile pane

  1. Select the fields you want to hide.

  2. Right-click, Ctrl-click (MacOS), from the More options menu, or from the toolbar menu, select Hide Field or Hide Fields.

  3. A new profile card is generated showing your hidden fields.

  4. To unhide fields, in the Hidden Fields profile card, select one or more fields, and either click the eye icon, right-click, or Ctrl-click (MacOS) and select Unhide Fields from the menu.

From the List view

  1. In a Clean step, on the toolbar, click the List view icon to change to the list view.

  2. Select one or more fields to hide or unhide.

  3. Click the eye icon to hide or unhide the fields.

Filters available for each data type

Data typeAvailable filters
StringCalculation, Wildcard Match, Null Values, Selected Values
NumberCalculation, Range of Values, Null Values, Selected Values
Date and Date & TimeCalculation, Range of Dates, Relative Date, Null Values, Selected Values

Where are my filter options?

To see the different filter options available for your fields, on the profile card, in the data grid or in the results pane, click the More optionsmenu. To see the menu on the data grid, you must click the Hide profile pane button first, and then click More options.

Calculation filter

When you select Calculation, the Add Filter dialog box opens. Enter the calculation, verify that it's valid, and click Save. Starting in version 2021.4.1 you can also include parameters in calculation filters. For more information, see Apply parameters to filter calculations.

Note: In the Input step this is the only type of filter that is available. All other filter types are available in the profile cards, data grid or results pane.

Selected Values filter

In Tableau Prep Builder version 2019.2.3 and later and on the web, you can use the Selected Values filter to pick and choose the values that you want to keep or exclude for a field, even values that aren't in your sample. In the right pane, click the Keep Only or Exclude tab to select your action, then enter search terms to search for values or click Add a value to add values that are in your data set but aren't included in your sample. Click Done to apply your filter.

Note: This filter options isn't available for Aggregation or Pivot step types.

Range of Values filter

Filter out values that fall within a specific range. When you select Range of Values, you can specify a range or set minimum or maximum values.

Range of Dates filter

Filter out values that fall within a specific date range. When you select Range of Dates, you can specify a range of dates or set a minimum or maximum date.

Relative Date filter

Use the Relative Dates filter to specify the exact range of years, quarters, months, weeks, or days that you want to see in your data. You can also configure an anchor relative to a specific date, and include null values.

Wildcard Match filter

When you select Wildcard Match, you can filter the field values to keep or exclude values that match a pattern. In the filter editor, select the Keep Only or Exclude tab, enter a value to match and then set the Matching Options criteria to return the values you are looking for.

The filtered results display in the left pane of the filter editor so that you can review and experiment with your results. Once you have the results you want, click Done to apply your change.

空值筛选器

选择“空值”时,可以筛选所选字段中的值,以仅显示空值或排除所有空值。