配置数据集

  • 版本 :2022.1 及更高版本

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

要确定要在流程中包含多少数据集,您可以配置数据集。当您连接到数据或将表拖到“流程”窗格中时,“输入”步骤会自动添加到流程中。这始终是流程中的第一步。您可以右键单击“输入”步骤以重命名或删除它。如果已连接到 Excel 或文本文件,则还可以从“输入”步骤刷新数据。有关如何从输入步骤刷新数据的详细信息,请参阅在输入步骤中添加更多数据(链接在新窗口中打开).

在输入步骤中,您可以查看有关数据集的详细信息。在这里,您可以搜索字段、查看示例值以及执行操作以减小数据集的大小,例如选择要包含的字段、选择要使用的数据示例或将筛选器应用于所选字段或行。您还可以通过更改字段名称或配置文本文件的文本设置来配置字段属性。

您还可以在“输入”步骤中更改支持它的数据连接的数据类型。其中包括Microsoft Excel,文本和PDF文件,以及来自Box,Dropbox,Google Drive和OneDrive的数据。对于其他数据源,您可以在清理步骤中更改数据类型。有关详细信息,请参阅查看分配给数据的数据类型

: 包含方括号的字段值将自动转换为括号。

连接到自定义 SQL 查询

如果数据库支持使用自定义 SQL,您将看到“连接”窗格底部附近显示“自定义 SQL”。双击“自定义 SQL”以打开“自定义 SQL”选项卡,您可以在其中输入查询以预选数据并使用特定于源的操作。查询检索数据集后,您可以选择要包含的字段、应用筛选器或更改数据类型,然后再将数据添加到流中。

有关使用自定义 SQL 的详细信息,请参阅使用自定义 SQL 连接到数据

在输入步骤中应用清理操作

Only some cleaning operations are available in an Input step. You can make any of the following changes in the Input field list. Your changes are tracked in the Changes pane and annotations are added to the left of the Input step in the Flow pane and in the Input field list.

  • Filter: Click Filter Values in the toolbar then enter your filter criteria in the calculation editor.

  • Rename Field: In the Field Name field, double-click or Ctrl-click (MacOS) on the field name and enter a new field name.

  • Change Data Type: Click on the data type for the field and select a new data type from the menu.

  • Remove Field: Clear the check box next to the fields that you don't want to include in your flow.

Select the fields to include in the flow

The Input pane shows you a list of fields in your data set. You can use the Search field to find fields in the list, and then use the check boxes to select the fields to include or exclude. To include or exclude all fields from the flow, toggle the check box at the top left of the grid.

Apply filters to fields in the Input step

To filter a field, do the following:

  1. In the toolbar click Filter Values.

  2. Enter your filter criteria in the calculation editor.

The calculation filter type is the only filter option available in the Input step. Other filter options are available in other step types. For more information, see Filter Your Data(Link opens in a new window)

Change field names

To change the name of a field, in the Field Name column, select the name, and then type the new name in the field. An annotation is added in the field grid and in the flow pane to the left of the Input step. Your changes are also tracked in the Changes pane.

Change data types

To change the data type for a field, do the following:

  1. Click the data type for the field.

  2. Select the new data type from the menu.


    You can also change the data type for fields in other step types in the flow or assign data roles to help validate your field values. For more information about changing your data type or using data roles, see Review the data types assigned to your data(Link opens in a new window) and Use Data Roles to Validate your Data(Link opens in a new window).

Configure field properties

When you work with text files, you see a Settings tab where you can edit your connection and configure text properties, such as the field separator for text files. You can also edit the file connection in the Connections pane or configure incremental refresh settings. For more information about setting up incremental refresh for your flow, see Refresh Flow Data Using Incremental Refresh .

When you work with text or Excel files, you can correct data types that have been inferred incorrectly before you even start your flow. Data types can always be changed in subsequent steps in the Profile pane after you start your flow.

Configure text settings in text files

To change the settings used to parse text files, select from the following options:

  • First line contains header (default): Select this option to use the first row as the field labels.

  • Generate field names automatically: Select this option if you want Tableau Prep Builder to auto-generate the field headers. The field naming convention follows the same model as Tableau Desktop. For example F1, F2, and so on.

  • Field Separator: Select a character from the list to use to separate the columns. Select Other to enter a custom character.

  • Text Qualifier: Select the character that encloses the values in the file.

  • Character Set: Select the character set that describes the text file encoding.

  • Locale: Select the locale to use to parse the file. This setting indicates which decimal and thousand separator to use.

Set your data sample size

To maintain peak performance, Tableau Prep limits the data included in the flow to a representative sample of your data set by default. The data sample is determined by calculating the optimal number of rows based on the total number of fields in the data set and the data types for those fields. Tableau Prep then retrieves the top number of rows for the calculated amount as quickly as possible.

The resulting data sample may include all the rows you need, or it may not, depending on how the sample was calculated and returned. If you don't see the data that you expect, you can change the data sample settings to run the query again.

When creating or editing flows on the web, limits are applied to the amount of data you can include in a flow and the options available to change your data sample are slightly different than when working in Tableau Prep Builder. For more information, see Sample data and processing limits in the Tableau Server(Link opens in a new window) or Tableau Online(Link opens in a new window) help.

注意:如果对数据进行了采样,则“已采样”徽章将显示在“配置文件”窗格中,并针对您添加的每个步骤保留。您所做的任何更改都将应用于您在流程中使用的示例。运行流程时,所有更改都将应用于整个数据集。

要更改数据示例设置,请选择“输入”步骤,然后在“数据示例”选项卡上从以下选项中进行选择:

  • 默认采样量(默认):Tableau Prep 计算要返回的总行数。

  • 使用所有数据:(仅限 Tableau Prep Builder)检索数据集中的所有行,而不考虑大小。这可能会影响性能或导致 Tableau Prep Builder 超时。

    注意:为了保持性能,即使选择此设置,也会对“聚合”和“合并”步骤类型应用 100 万行的数据样本限制,对“联接”和“透视”步骤类型应用 300 万行的数据样本限制。

  • 固定行数:选择要从数据集返回的行数。建议的行数为 100 万或更少。将行数设置为超过 100 万可能会影响性能。

    • 在 Web 制作中:用户在使用大型数据集时可以选择的最大行数由管理员配置。作为用户,您可以选择达到该限制的行数。

  • 快速选择(默认):数据库尽可能快地返回请求的行数。这可能是前 N 个行数,也可能是数据库从上一个查询缓存在内存中的行数。

  • 随机样本:数据库返回请求的行数,但查看数据集中的每一行,并从所有行中返回一个代表性样本。此选项可能会影响首次检索数据时的性能。