Tableau - Crosstab
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.
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 − Drag and drop the dimension order date to the columns shelf.
Step 2 − Drag and drop the dimensions region and segment to the rows shelf.
Step 3 − Pull the measure Sales to the labels Shelf under Marks.
The following chart appears which shows the Crosstab.
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.
Crosstab with Row Percentage
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).
On clicking OK in the screen above, you will find the crosstab chart created with percentage values as shown in the following screenshot.