Tableau error Syntax

The calculation contains errors

Expected closing parentheses or comma

A function call is missing its closing ) or a comma between arguments. Here SUM([Profit] never closes, so Tableau reads the rest of the formula as part of it.

Updated · Checked on the xmetric engine

Which formula raises it, and what fixes it?

Raises the error
SUM([Profit] / SUM([Sales])
Tableau: Expected closing parentheses or comma

The xmetric engine rejects it too.

Fixed
SUM([Profit]) / SUM([Sales])

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

RegionResult
East0.2
West−0.07

Why it works. Each SUM now wraps exactly one field, and the division sits between two totals. Count the ( and ) in the formula: they must match. A missing comma, as in SPLIT([Customer Name] " ", 1), gives the same message.

The 3 example rows
RegionSalesProfit
East204
West10-2
West51

What else raises this message?

  1. Raises it

    ROUND(SUM([Sales]) / SUM([Profit]), 2

    Fixed

    ROUND(SUM([Sales]) / SUM([Profit]), 2)

    Each opening parenthesis needs its closing one; here ROUND was never closed.

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

  2. Raises it

    IIF(SUM([Profit]) > 0, 'Profit' 'Loss')

    Fixed

    IIF(SUM([Profit]) > 0, 'Profit', 'Loss')

    Arguments are separated by commas; the missing comma reads as one broken argument.

    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], [Profit]; 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 find the missing parenthesis in a long formula?

Put each function on its own line with indentation. Tableau's editor highlights the matching parenthesis when the cursor sits next to one.

Can a missing quote cause this error?

Yes. An unclosed string swallows the parenthesis after it, so the parser reports a missing ) further on.

Where is this message documented?