KNOWLEDGE BASE

Error “All fields must be aggregate or constant…”


Published: 19 Mar 2013
Last Modified Date: 14 Aug 2017

Issue

When you are typing a formula in a calculated field dialog box, the following error might occur:

All fields must be aggregate or constant when using Table Calculations or fields from multiple data sources

Environment

Tableau Desktop

Resolution

Wrap affected fields in aggregations.

For example, the following calculation causes the error described above:

[Field 1] - [SecondaryDataSource.Field1]

This modified calculation resolves the issue:

SUM([Field 1]) - SUM([SecondaryDataSource.Field1])

If date fields are used in the calculation, they can be aggregated using the MAX(), MIN(), or ATTR() functions. In most cases, these aggregations will not impact the results of the calculation.

Did this article resolve the issue?