Tableau error Syntax
Expected 'END' to match 'IF' at character 0
Your IF has no END. Every IF in Tableau closes with END; "character 0" points at the IF that is left open.
Which formula raises it, and what fixes it?
IF [Profit] > 0 THEN 'Profitable' ELSE 'Non-Profitable'The xmetric engine rejects it too.
IF [Profit] > 0 THEN 'Profitable'
ELSE 'Non-Profitable'
ENDOn each of the 3 example rows it returns:
| Region | Profit | Result |
|---|---|---|
| East | 4 | Profitable |
| West | −2 | Non-Profitable |
| West | 1 | Profitable |
Why it works. END closes the IF block. In a long formula the character number tells you which IF is open: count from 0 at the first character.
The 3 example rows
Region | Profit |
|---|---|
| East | 4 |
| West | -2 |
| West | 1 |
What else raises this message?
Raises it
IF [Profit] > 0 THEN 'Yes'Fixed
IF [Profit] > 0 THEN 'Yes' ENDEvery IF ends with END, even without ELSE.
Checked on the xmetric engine: the first fails, the fix runs.
Raises it
IF [Profit] > 0 THEN IF [Profit] > 2 THEN 'Big' ELSE 'Small' ENDFixed
IF [Profit] > 0 THEN IF [Profit] > 2 THEN 'Big' ELSE 'Small' END ENDA nested IF needs its own END, then the outer one closes too.
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], [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?
Can I write IIF instead to avoid END?
Yes, for a single test: IIF([Profit] > 0, 'Profitable', 'Non-Profitable'). IIF also handles unknown results with an optional fourth argument.
How many END do nested IFs need?
One per IF. With ELSEIF there is only one IF, so one END.
Where is this message documented?
- Where the message is reported (thedataschool.co.uk) checked October 17, 2026