Tableau 简明教程

Tableau - Crosstab

Tableau 中的交叉表图表也称为文本表,它以文本形式显示数据。该图表由一个或多个维度和一个或多个度量值组成。该图表还可以显示度量值字段值的不同计算,例如运行总计、百分比总计等。

A crosstab chart in Tableau is also called a Text table, which shows the data in textual form. The chart is made up of one or more dimensions and one or more measures. This chart can also show various calculations on the values of the measure field such as running total, percentage total, etc.

Simple Crosstab

使用 Sample-superstore(样品超级商店),我们计划获得每个区域中每个细分市场的销售金额。您需要使用可用的订单日期,按年份显示此数据。为实现此目标,请执行以下步骤。

Using the Sample-superstore, let’s plan to get the amount of sales for each segment in each region. You need to display this data for each year using the order dates available. To achieve this objective, following are the steps.

Step 1 − 将维度顺序日期拖放到列功能区。

Step 1 − Drag and drop the dimension order date to the columns shelf.

Step 2 − 将维度区域和细分拖放到行功能区。

Step 2 − Drag and drop the dimensions region and segment to the rows shelf.

Step 3 − 将度量销售拉到“标记”下的标签功能区。

Step 3 − Pull the measure Sales to the labels Shelf under Marks.

将显示以下图表,其中显示交叉表。

The following chart appears which shows the Crosstab.

cross tab1

Crosstab - Color Encoded

您可以通过将度量字段拖放到颜色功能区(如下图所示)来获取交叉表图表中的值颜色编码。该颜色编码显示了颜色强度,具体取决于度量的值。值越大,阴影越深,反之亦然。

You can get the values color encoded in the crosstab chart by dropping the measure field into the Color shelf as shown in the following screenshot. This color coding shows the strength of the color depending on the value of the measure. The larger values have a darker shade than the lighter values.

cross tab2

Crosstab with Row Percentage

除了颜色编码外,您还可以对度量中的值应用计算。在以下示例中,我们将应用计算以找到每一行中的总销售百分比,而不仅仅是销售数字。为此,右键单击标记卡中显示的 SUM(Sales),然后选择“添加表计算”选项。然后,选择“总和的百分比”,并将其汇总为“Table(Across)”。

In addition to the color encoding, you can also get calculations applied to the values from the measure. In the following example, we apply the calculation for finding the percentage total of sales in each row instead of only the sales figures. For this, right-click on SUM (Sales) present in the marks card and choose the option Add Table Calculation. Then, choose the percent of total and summarize it as Table (Across).

cross tab3

在以上屏幕中单击“确定”后,您将找到创建的带有百分比值交叉表图表,如下图所示。

On clicking OK in the screen above, you will find the crosstab chart created with percentage values as shown in the following screenshot.

cross tab4