Tableau - "Cannot mix aggregate and non-aggregate arguments with this function."

Have you received the error “Cannot mix aggregate and non-aggregate arguments with this function.” in Tableau before? Take the below as an example:

42-1.png

For calculations in Tableau to work properly, they need to be equally aggregated. See this post for a detailed explanation on why.

Back to the above example, let’s say we still want a calculated field that we can use as a filter to only keep data from the latest date. Here’s how you get around that:

42-2.png

The only change was wrapping the MAX([Order Date]) argument in curly braces {}. Why does that work?

By adding the curly braces, we added a FIXED statement to the argument MAX([Order Date]). Generally, an aggregation (like MAX) takes place at the level of detail (dimension) displayed in the worksheet. However, when we just wrap the argument in the curly braces, we tell Tableau to search the entire data source and return the maximum date. After Tableau does this, it doesn’t consider that value an aggregated field so it can be used in conjunction with other fields that aren’t aggregated in the calculation.

42-3.png

Need more help? Sign up for an office hour to gets your problems sorted today!

OneNumber Events in Q2

How do Tableau Table Calculations Work?

0