Tableau function String

Tableau UPPER to SQL

UPPER(string) returns the string in upper case: Café Nord becomes CAFÉ NORD. DuckDB's upper() matches. When UPPER is there to merge East and east, keep it in the SQL's DISTINCT or GROUP BY: DuckDB compares case sensitively.

Updated · Checked on the xmetric engine

What is the syntax?

UPPER(string)
string
the text.

Returns the string in upper case. Null if the string is null.

What does it return, and what is the SQL?

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

What does each name look like in capitals?

Tableau

UPPER([Name])

SQL (DuckDB)

SELECT upper(Name) AS result
FROM input
ORDER BY id

mary-jo o'neil becomes MARY-JO O'NEIL.

NameResult
Ann LeeANN LEE
bob rayBOB RAY
Café NordCAFÉ NORD
eastEAST
EastEAST
mary-jo o'neilMARY-JO O'NEIL
null

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

Where does a straight translation go wrong?

Common mistake

Why does the SQL count East and east separately?

DuckDB's DISTINCT is case sensitive. COUNTD(UPPER([Name])) merges the two spellings; dropping UPPER in the SQL counts 6 names, not 5.

Tableau

COUNTD(UPPER([Name]))

Tempting SQL

SELECT count(DISTINCT Name) AS result
FROM input

SQL that matches

SELECT count(DISTINCT upper(Name)) AS result
FROM input
TableauTempting SQLSQL that matches
565

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 UPPER(Name) AS result
FROM input
ORDER BY id

Snowflake documentation

BigQuery

SELECT UPPER(Name) AS result
FROM input
ORDER BY id

BigQuery documentation

What does your own UPPER formula return?

Edit the formula and run it on the 7 sample rows. Fields: [id], [Name], [Code], [Email], [Num].

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

Which functions go with it?

What do people ask about UPPER?

Does UPPER handle accents?

Yes: é becomes É in both Tableau and DuckDB.

What does UPPER return for a null?

Null. Row 7 has no name.

Where is this documented?