0
0
Tableaubi_tool~7 mins

Aggregate vs row-level calculations in Tableau - Compared

Choose your learning style9 modes available
Introduction
This feature helps you understand the difference between calculations done on each row of data and calculations done on groups of data. It solves the problem of knowing when to use each type to get the right results in your Tableau reports.
When you want to calculate the total sales for each product category (aggregate).
When you need to find the profit margin for each individual sale (row-level).
When creating a dashboard that shows average sales per region (aggregate).
When you want to highlight orders where the discount is greater than 10% (row-level).
When comparing the sum of sales to the average sales per customer (mix of aggregate and row-level).
Steps
Step 1: Open
- Tableau Desktop and connect to your data source
Your data appears in the Data pane on the left side
Step 2: Create a calculated field
- Data pane → right-click → Create Calculated Field
A dialog box opens where you can type your formula
Step 3: Type a row-level calculation formula
- Calculated Field dialog
The formula applies to each row of data separately
💡 Use fields directly without aggregation functions, e.g., [Sales] - [Cost]
Step 4: Create another calculated field
- Data pane → right-click → Create Calculated Field
Another dialog box opens for a new formula
Step 5: Type an aggregate calculation formula
- Calculated Field dialog
The formula calculates over groups of data, not individual rows
💡 Use aggregation functions like SUM(), AVG(), e.g., SUM([Sales]) / COUNT([Orders])
Step 6: Drag both calculated fields to Rows or Columns shelf
- Tableau worksheet view
You see the difference in results between row-level and aggregate calculations
Before vs After
Before
A table shows individual sales records with columns: Order ID, Sales, Cost
After
A table shows a new column with profit per sale (row-level) and another column with total sales per category (aggregate)
Settings Reference
Aggregation functions
📍 Calculated Field dialog
To perform calculations on groups of rows instead of individual rows
Default: No aggregation (row-level) unless specified
Calculation type
📍 Calculated Field dialog
To choose whether the calculation applies to each row or to aggregated data
Default: Row-level
Common Mistakes
Using aggregation functions inside a calculation meant for row-level results
It causes the calculation to summarize data too early, losing detail
Use simple field references for row-level calculations and aggregation functions only when you want grouped results
Mixing aggregate and row-level calculations without using LOD expressions
Tableau cannot combine them directly and shows errors
Use Level of Detail (LOD) expressions to mix row-level and aggregate calculations properly
Summary
Row-level calculations work on each individual data row without summarizing.
Aggregate calculations summarize data using functions like SUM or AVG.
Choose the right calculation type to get accurate results in your Tableau reports.