Tableau error Type mismatch
Expected type integer, found string.Result types from 'IF' expressions must match.
The branches of your IF return different types: a number after THEN, text after ELSE. Every THEN and ELSE in one IF must return the same type.
Which formula raises it, and what fixes it?
IF [Sales] > 0 THEN 1 ELSE "no" ENDThe xmetric engine rejects it too.
IF [Sales] > 0 THEN 1 ELSE 0 ENDOn each of the 3 example rows it returns:
| Region | Sales | Result |
|---|---|---|
| East | 20 | 1 |
| West | 10 | 1 |
| West | −5 | 0 |
Why it works. Both branches now return numbers, so the field is numeric. If you want labels instead, make both branches text, for example "yes" and "no".
The 3 example rows
Region | Sales |
|---|---|
| East | 20 |
| West | 10 |
| West | -5 |
What else raises this message?
Raises it
IF [Sales] > 10 THEN 'High' ELSE [Sales] ENDFixed
IF [Sales] > 10 THEN 'High' ELSE STR([Sales]) ENDEvery branch of an IF must return the same type; STR turns the number into text.
Checked on the xmetric engine: the first fails, the fix runs.
Raises it
IF [Region] = 'East' THEN TRUE ELSE 'No' ENDFixed
IF [Region] = 'East' THEN TRUE ELSE FALSE ENDPick one type per field: a boolean here, which also lets you write just [Region] = 'East'.
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 return a blank for some rows?
Leave out ELSE: rows that match no branch return NULL, and NULL fits any type. Writing ELSE '' turns a numeric field into text.
Does CASE have the same rule?
Yes. Every WHEN and the ELSE of a CASE must return the same type.
Where is this message documented?
- Where the message is reported (trailhead.salesforce.com) checked October 17, 2026