/    /  Tableau Crosstab

CrossTab in Tableau

 

In Tableau, CrossTab is a type of chat that is also called a text table or pivot table. The cross tab contains one or more measures as well as dimensions for the visualization. It also supports calculated fields for dynamic value representation. Tableau’s CrossTab tool can be used to create a variety of reports and charts, such as sales and profit statistics for a range of products over time. For business users, CrossTab is extremely useful. The best practices for cross-tabulation in Tableau include naming conventions and data hierarchy when developing reports and visualizations.

In Tableau, all data is divided into two categories by default

  1. Dimension: It contains qualitative values such as Name, Date, Location, etc. Your data’s level of detail is affected by them.
  2. Measures: This section contains quantitative and numerical values. Measures can be calculated.

Forming a Crosstab in Tableau

The restaurant’s data is available to us. We will use the Excel file as our data source.

Step 1: You will need to connect to the “Microsoft Excel” file.

Step 2: In this case, we need to select the file ‘Coffee File.xlsx’ from the location where it exists. Once the data has been retrieved from the Excel sheet, the following screen appears.

Step 3: Start a new worksheet. Tableau displays a variety of charts in the top right corner. One of these is the Text Table, also known as CrossTab. A text table requires one or more dimensions and one or more measures, as indicated in the box.

Step 4: Drag and drop the dimensions “Product Type” and “Products” into the row shelf.

Step 5:  In the column shelf, drag and drop the dimension “Date”.

Step 6: Under the Marks Shelf, drag and drop the measure “Sales”.

The outcome of the above action forms a “Crosstab”.


Step 7: Color-Coded Text Table

By adding colors to the measures, you can make the chart even more attractive and informative. Drag and drop the Measure “Sales” into the color Mark card to color-code your values.

A darker shade indicates a higher sale, while a lighter shade indicates a lower sale.
It appears that your chart is now telling its own story, which may be what you had hoped for.

Step 8: Calculations on rows – In addition to performing calculations on rows, we can also perform calculations on measures. The steps below should be followed.

  1. On the Mark card, click the down arrow next to the Sales field.
  2. Select the option Add Table Calculation.
  3. Select “Percent of total” as the calculation type, and then select the Table(down) option from the drop-down menu under “compute using the field”.
  4. The chart now displays the percentage of values.


Step 9: Using Profit as a measure, we can also create reports that show which product has the highest profit over a specific period of time.

Where to use CrossTab in Tableau

Most often, it is used to illustrate the relationship between two or more dimensions.

Tableau Best Practices

  • Naming convention: From your data source sheet or SQL query to your worksheet, dashboard, or story, you should give everything a valid name. By following this practice from the start, you will be able to build a vast dashboard consisting of multiple sheets and data sources in the long run.
  • Form Hierarchy: Spend the first few minutes simply reviewing the data and attempting to form hierarchies. In the case of Coffee File Data, the product type and product can be arranged in a hierarchical manner. Additionally, Market Size, Market, State, and Area Code can be used for another hierarchy of data

Conclusion

Due to its close resemblance to the Pivot table in Excel, Crosstab / Text Tables are also known as Pivot tables. The crosstab chart is one of the most basic and widely used types of chart in tableau. Data storytelling can be enhanced by adding color and calculations.