Tableau error Aggregation

The calculation contains errors

Argument to sum (an aggregate function) is already an aggregation, and cannot be further aggregated.

You wrapped an aggregate in another aggregate, like SUM(SUM([Sales])). The inner SUM already returns one total per mark, and Tableau will not aggregate that total again in the same view.

Updated · Checked on the xmetric engine

Which formula raises it, and what fixes it?

Raises the error
SUM(SUM([Sales]))
Tableau: Argument to sum (an aggregate function) is already an aggregation, and cannot be further aggregated.

The xmetric engine rejects it too.

Fixed
SUM([Sales])

Per Region, on the 3 example rows, it returns:

RegionResult
East20
West15

Why it works. One SUM gives the group total you want. If you meant a running or overall total across the marks, that is a table calculation such as RUNNING_SUM(SUM([Sales])), not a nested aggregate.

The 3 example rows
RegionSales
East20
West10
West5

What else raises this message?

  1. Raises it

    AVG(SUM([Sales]))

    Fixed

    WINDOW_AVG(SUM([Sales]))

    An average of per-region sums is a table calculation over the marks, not an aggregate of an aggregate.

    Checked on the xmetric engine: the first fails, the fix runs.

  2. Raises it

    SUM(COUNT([Region]))

    Fixed

    COUNT([Region])

    Count once. To add counts across the view, use TOTAL(COUNT([Region])) or WINDOW_SUM.

    Checked on the xmetric engine: the first fails, the fix runs.

Does my formula have this problem?

Paste your formula and run it on the example rows. It uses the fields [Region], [Sales]; rename yours to match.

Runs in your browser on the xmetric engine. Nothing is uploaded.

Which functions does this involve?

What do people ask about this error?

How do I average the monthly totals, then?

Two ways. As a table calculation, WINDOW_AVG(SUM([Sales])) averages the totals shown in the view. As a level of detail, AVG({ FIXED [Month] : SUM([Sales]) }) averages totals computed at the month level, whatever the view shows.

My field is already a SUM in another calculated field. Is that the problem?

Yes. A calculated field that contains SUM is itself an aggregate, so wrapping it in SUM again nests the aggregation. Use the field as it is, or rewrite the inner field as row-level.

Where is this message documented?