NOT [p] turns true into false and false into true; null stays null, as in SQL. NOT binds looser than comparisons, so NOT [a] > 5 means NOT ([a] > 5). Translating it as p IS NOT TRUE or coalesce(NOT p, true) counts missing values as true.
Updated · Checked on the xmetric engine
What is the syntax?
NOT a
a
a boolean or a comparison.
Returns true, false or null: the opposite of a.
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 have p false?
Tableau
NOT[p]
SQL (DuckDB)
SELECTNOT p AS result
FROM input
ORDERBY id
Rows 5 and 6 have no p, so the result is null.
p
Result
true
false
true
false
false
true
false
true
null
null
true
false
false
true
✓ The Tableau formula and the SQL return the same 8 rows.
How does NOT read with a comparison?
Tableau
NOT[a]>5
SQL (DuckDB)
SELECTNOT a >5AS result
FROM input
ORDERBY id
It negates the whole comparison: row 1 (7 > 5) becomes false.
a
Result
7
false
−7
true
2
true
9
false
5
true
null
1
true
−3
true
✓ The Tableau formula and the SQL return the same 8 rows.
Where does a straight translation go wrong?
Common mistake
Why does p IS NOT TRUE return true for missing flags?
IS NOT TRUE treats null as not true. Tableau keeps it null, so the rows drop out of a filter and an IIF.
Tableau
NOT[p]
Tempting SQL
SELECT p ISNOTTRUEAS result
FROM input
ORDERBY id
SQL that matches
SELECTNOT p AS result
FROM input
ORDERBY id
p
Tableau
Tempting SQL
SQL that matches
true
false
false
false
true
false
false
false
false
true
true
true
false
true
true
true
null
true
null
null
true
null
true
false
false
false
false
true
true
true
✓ 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.