Last Modified Date: 16 Aug 2016
When creating a calculated field, you may see a “Cannot mix aggregate and non-aggregate arguments to function” error message. This message is shown when a calculation contains a mix of disaggregated (row-level) values and aggregated values. Aggregations allow you to look at numerical data in summary form, such as sum or average. In the formula below, the Sales field is an aggregated value (SUM), but the Profit field is a disaggregated value:
To resolve the issue, apply an aggregation to the Profit field, or remove the aggregation from the Sales field.
In other cases, you may have both a dimension and a measure in your formula:
IF [Category] = 'Technology" THEN SUM([Sales]) END
Because Category is not aggregated, Tableau will show the same error as in the first example. Resolve the issue by applying an aggregation (ATTR) to the dimension field:
IF ATTR([Category]) = 'Technology" THEN SUM([Sales]) END
Although Category is a dimension, it needs to be aggregated because Sales is aggregated.
For more information about aggregations, see Aggregations.
Alternate Search Terms:cannot mix aggregate and non-aggregate arguments to function, calculation, calculation contains errors, formula, equation, aggregate, aggregation