Skip to main content
Albero Academy

Aggregate Calculations

Row-level vs aggregate calcs — and why the difference matters.

Calculations8 min

A crucial distinction: a row-level calc computes per row then aggregates; an aggregate calc aggregates first, then computes. Getting this right is the difference between a correct and a wrong ratio.

The classic example

order matters
// WRONG for a total ratio — averages per-row ratios
Profit Ratio (row) = [Profit] / [Sales] → then SUM/AVG of ratios
// RIGHT — aggregate first, then divide
Profit Ratio (agg) = SUM([Profit]) / SUM([Sales])

Key takeaways

  1. 01Row-level calc: compute per row, then aggregate. Aggregate calc: aggregate first, then compute.
  2. 02For group ratios/rates, aggregate then divide: SUM(Profit)/SUM(Sales).
  3. 03Averaging row-level ratios gives a different, usually wrong, answer.
  4. 04Tableau blocks mixing aggregate and non-aggregate in one calc.

Finished this chapter?

Mark it complete to track your progress through Tableau.