What is a calculated field in Tableau?
beginnerAnswer
A calculated field is a new field you define with a formula, computed from existing fields rather than read from the source.
Create one from Analysis → Create Calculated Field, or by right-clicking in the Data pane. It then behaves like any other field and can be used on shelves, in filters, or inside other calculations.
The types worth distinguishing:
- Row-level — evaluated per row, e.g. `[Sales] - [Cost]`. - Aggregate — operating on aggregated values, e.g. `SUM([Profit]) / SUM([Sales])`. - Table calculations — computed on the query result already in the view. - LOD expressions — computed at a granularity other than the view's.
The error people meet first is mixing aggregate and non-aggregate arguments — `SUM([Sales]) - [Cost]` will not validate, because one side is one value per group and the other is one per row. And for ratios, always divide the totals rather than averaging row-level ratios, which weights small rows equally with large ones.
Related questions