Tableau is a specialised visual analytics tool known for fast, drag-and-drop exploration and attractive, interactive dashboards.

The Tableau Workspace

Tableau connects to Excel, text files, databases and cloud sources. The workspace has a Data pane listing the fields, shelves (Columns and Rows), a Marks card to control colour, size, label and detail, and a canvas. A worksheet holds one chart, a dashboard combines several worksheets and a story arranges worksheets in sequence as a presentation. Tableau Desktop is the authoring tool, Tableau Public is a free version that publishes to a public gallery, and Tableau Server or Cloud shares dashboards inside an organisation.

Dimensions and Measures

Tableau divides fields into two kinds. Dimensions are qualitative fields used to categorise, such as Region, Product and Date; they usually appear in blue. Measures are numerical fields that can be aggregated, such as Sales and Profit; they appear in green. Dragging a dimension and a measure to the shelves produces a chart in which the measure is aggregated (summed, averaged and so on) for every dimension value.

Calculated Fields and Aggregation

A calculated field creates a new value by a formula, such as Profit Ratio = SUM([Profit]) / SUM([Sales]). Order matters: the formula should aggregate first and divide afterwards. Averaging row-level ratios gives a different, usually wrong, answer because it ignores the size of each row.

Strengths and Limits

Tableau is excellent for exploring large data visually and for polished interactive dashboards. It is a commercial product with licence cost, has a learning curve for advanced calculations, and needs data prepared well.

Definition: Dimension and measure. A dimension is a categorical field used to group data; a measure is a numerical field that is aggregated, such as the sum or average of sales.

Table 2.2: Dimensions and measures

Aspect Dimension Measure
Nature Qualitative, categorical Quantitative, numerical
Examples Region, Product, Date Sales, Profit, Quantity
Role Splits data into groups Aggregated for each group
Colour in Tableau Blue Green

Example 2.2: Ratio of sums against average of ratios

Problem: Two orders have Sales 100 with Profit 10, and Sales 400 with Profit 100. Compute the profit ratio (a) as the average of the two order ratios and (b) as SUM(Profit) / SUM(Sales).

Solution:

  1. Order ratios: 10 / 100 = 10 percent and 100 / 400 = 25 percent.
  2. (a) The average of the two ratios is (10 + 25) / 2 = 17.5 percent.
  3. (b) The ratio of sums is (10 + 100) / (100 + 400) = 110 / 500 = 22 percent.
  4. The larger order carries more weight, so 22 percent is the correct overall profit ratio.

Result: The correct profit ratio is 22 percent; the simple average of ratios (17.5 percent) is misleading.

import pandas as pd
orders = pd.DataFrame({"Sales": [100, 400], "Profit": [10, 100]})
orders["Ratio"] = orders["Profit"] / orders["Sales"]
print("Average of ratios:", orders["Ratio"].mean() * 100, "%")
overall = orders["Profit"].sum() / orders["Sales"].sum()
print("Ratio of sums    :", overall * 100, "%")

Output

Average of ratios: 17.5 %
Ratio of sums    : 22.0 %

Common mistakes

  • Dividing row by row and then averaging the ratios.
  • Putting a numerical code such as a pin code in the measures.
  • Overloading one dashboard with too many worksheets.
  • Publishing sensitive data to Tableau Public, which is open to everyone.

Key takeaways

  • Dimensions categorise; measures are aggregated.
  • Worksheet, dashboard and story are the three levels of output.
  • Use SUM(a) / SUM(b), not the average of row ratios.
  • Tableau Public is free but public.

Practice questions

  1. Distinguish a dimension from a measure.
  2. What is a Tableau story?
  3. Why compute a ratio as sum over sum?

Answers to the practice questions

  1. A dimension is a categorical field for grouping; a measure is a numerical field that is aggregated.
  2. A sequence of worksheets or dashboards presented as a narrative.
  3. To weight each row by its size and avoid the error of averaging ratios.

Sources

  • Official BCA syllabus Data Visualization, course code 26BCA404DSE11, Unit II