Tableau function Operators

Tableau = (equal) to SQL

[a] = [b] is true when the values are equal and null when either is missing. On extracts and files, text compares without regard to case: West = west is true. DuckDB's = is case sensitive, so lower both sides. IS NOT DISTINCT FROM is not a safer =: it turns the nulls into false.

Updated · Checked on the xmetric engine

What is the syntax?

a = b
a, b
two values of the same kind: numbers, strings, dates or booleans.

Returns true, false, or null when either side is null.

What does it return, and what is the SQL?

Each example runs on the same 8 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.

Which rows pass a = b?

Tableau

[a] = [b]

SQL (DuckDB)

SELECT a = b AS result
FROM input
ORDER BY id

No pair is equal; rows 6 and 7 are null because a value is missing.

abResult
72false
−72false
25false
94false
53false
2null
1null
−3−2false

The Tableau formula and the SQL return the same 8 rows.

How does = compare two text fields?

Tableau

[s] = [t]

SQL (DuckDB)

SELECT lower(s) = lower(t) AS result
FROM input
ORDER BY id

Case is ignored, so row 1 (West, west) compares as equal text.

stResult
Westwesttrue
EastNorthfalse
NorthNorthtrue
southEastfalse
Eastnull
Westnull
EastSouthfalse
easteasttrue

The Tableau formula and the SQL return the same 8 rows.

Where does a straight translation go wrong?

Common mistake

Why does s = t say West and west differ?

Tableau's default collation on extracts and files ignores case, so West and west (row 1) compare as equal. DuckDB compares the bytes. Lower both sides.

Tableau

[s] = [t]

Tempting SQL

SELECT s = t AS result
FROM input
ORDER BY id

SQL that matches

SELECT lower(s) = lower(t) AS result
FROM input
ORDER BY id
stTableauTempting SQLSQL that matches
Westwesttruefalsetrue
EastNorthfalsefalsefalse
NorthNorthtruetruetrue
southEastfalsefalsefalse
Eastnullnullnull
Westnullnullnull
EastSouthfalsefalsefalse
easteasttruetruetrue

The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.

Common mistake

Why does IS NOT DISTINCT FROM return false for missing values?

It is a null-safe comparison: null versus 2 is false. Tableau returns null, which a filter treats differently from false in counts and IIF.

Tableau

[a] = [b]

Tempting SQL

SELECT a IS NOT DISTINCT
FROM b AS result
FROM input
ORDER BY id

SQL that matches

SELECT a = b AS result
FROM input
ORDER BY id
abTableauTempting SQLSQL that matches
72falsefalsefalse
−72falsefalsefalse
25falsefalsefalse
94falsefalsefalse
53falsefalsefalse
2nullfalsenull
1nullfalsenull
−3−2falsefalsefalse

The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.

How do I write it in Snowflake or BigQuery?

The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.

Snowflake

SELECT LOWER(s) = LOWER(t) AS result
FROM input
ORDER BY id

Snowflake documentation

BigQuery

SELECT LOWER(s) = LOWER(t) AS result
FROM input
ORDER BY id

BigQuery documentation

What does your own = formula return?

Edit the formula and run it on the 8 sample rows. Fields: [id], [a], [b], [x], [p], [q], [s], [t], [d], [e].

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

Which functions go with it?

What do people ask about =?

What happens when one side is null?

The comparison returns null, not false, in Tableau and in SQL. A filter drops those rows, and IIF returns null for them.

Is the string comparison case sensitive?

On an extract or a file source, no: Tableau's default string collation ignores case, so West and west compare as equal. On a live connection the database's collation decides. DuckDB compares case sensitively, so lower both sides to match an extract.

Is = the same as ==?

Yes. Tableau accepts both spellings; see ==.

Where is this documented?