RAWSQL_DATE("%1 + 7", [Ordered]) sends Ordered + 7 to the database and reads the answer as a date. The SQL is the expression with %1 replaced, cast to DATE so it matches what Tableau shows: a date-time column passed through RAWSQL_DATE loses its time. Date arithmetic is where dialects differ most, so check the text against the target database.
a string constant of SQL in your data source's dialect. %1, %2, ... are placeholders for the arguments that follow, numbered from 1.
argument, ...
fields or expressions. Tableau puts the first one where %1 is, the second where %2 is, and so on.
Returns a date per row (no time part): the database's answer read as a date. Null when the expression is null.
What does it return, and what is the SQL?
Each example runs on the same 6 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
What is the date one week after each order?
Tableau
RAWSQL_DATE("%1 + 7", [Ordered])
SQL (DuckDB)
SELECT Ordered +7AS result
FROM input
ORDERBY id
DuckDB adds days when you add an integer to a date. BigQuery rejects date + 7; it needs DATE_ADD.
Ordered
Result
2026-01-30
2026-02-06
2026-02-03
2026-02-10
2026-02-11
2026-02-18
2026-02-14
2026-02-21
2026-03-01
2026-03-08
2026-03-09
2026-03-16
✓ The Tableau formula and the SQL return the same 6 rows.
On which day did each line ship?
Tableau
RAWSQL_DATE("%1", [Shipped])
SQL (DuckDB)
SELECTCAST (Shipped AS DATE) AS result
FROM input
ORDERBY id
Line 4 has not shipped, so its date is null.
Shipped
Result
2026-01-3118:20
2026-01-31
2026-02-0509:05
2026-02-05
2026-02-1123:40
2026-02-11
null
2026-03-0307:15
2026-03-03
2026-03-1012:00
2026-03-10
✓ The Tableau formula and the SQL return the same 6 rows.
Where does a straight translation go wrong?
Common mistake
Why does the SQL still show the shipping time?
RAWSQL_DATE returns a date, so 18:20 on 31 January becomes 31 January. Copying the expression without the cast keeps the timestamp, and the values no longer match Tableau or group by day.
Tableau
RAWSQL_DATE("%1", [Shipped])
Tempting SQL
SELECT Shipped AS result
FROM input
ORDERBY id
SQL that matches
SELECTCAST (Shipped AS DATE) AS result
FROM input
ORDERBY id
Shipped
Tableau
Tempting SQL
SQL that matches
2026-01-3118:20
2026-01-31
2026-01-3118:20
2026-01-31
2026-02-0509:05
2026-02-05
2026-02-0509:05
2026-02-05
2026-02-1123:40
2026-02-11
2026-02-1123:40
2026-02-11
null
null
null
2026-03-0307:15
2026-03-03
2026-03-0307:15
2026-03-03
2026-03-1012:00
2026-03-10
2026-03-1012:00
2026-03-10
✓ 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
SELECTDATEADD(day, 7, Ordered) AS result
FROM input
ORDERBY id
The first argument after the SQL string. %2 is the second, and so on, whatever order the placeholders appear in the text. To translate a RAWSQL call, replace each %n with the column it points at and keep the rest of the text.
Does Tableau check the SQL inside RAWSQL?
No. Tableau passes the text to the database as it is, so a typo or a function your database lacks fails at query time, in the database. The text is also tied to that database's dialect: point the workbook at a different database and the same text can fail or mean something else.