TODAY() returns the current local date, with no time of day, and takes no argument. In DuckDB the match is current_date. Compare it with dates, not with now(): a date and a date-time are equal only at midnight. The examples compare against TODAY instead of showing it, so their results don't change from day to day.
Updated · Checked on the xmetric engine
What is the syntax?
TODAY()
Returns a date: the current local date.
What does it return, and what is the SQL?
Each example runs on the same 9 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
Was each order due before today?
Tableau
[Due]<TODAY()
SQL (DuckDB)
SELECT Due < current_date AS result
FROM input
ORDERBY id
Every sample due date is in the past, so the answer stays true; the blank row stays null.
Due
Result
2021-01-01
true
2021-01-03
true
2024-02-29
true
2024-12-29
true
2024-12-30
true
2025-01-31
true
2025-03-01
true
2025-03-02
true
null
✓ The Tableau formula and the SQL return the same 9 rows.
Is midnight tomorrow always later than now?
Tableau
DATEADD('day', 1, TODAY()) >NOW()
SQL (DuckDB)
SELECT current_date
+INTERVAL1 DAY >CAST (now() AS TIMESTAMP) AS result
FROM input
ORDERBY id
Adding a day to TODAY gives the start of tomorrow, the usual upper bound for "today" filters: [Ordered] >= TODAY() AND [Ordered] < DATEADD('day', 1, TODAY()).
Result
true
true
true
true
true
true
true
true
true
✓ The Tableau formula and the SQL return the same 9 rows.
Where does a straight translation go wrong?
Common mistake
Why is today's date never equal to now()?
TODAY is a date, which compares as midnight. now() has the time of day, so current_date = now() is false almost all day. Cast now() to a date, as DATE(NOW()) does.
Tableau
TODAY() =DATE(NOW())
Tempting SQL
SELECT current_date =CAST (now() AS TIMESTAMP) AS result
FROM input
ORDERBY id
SQL that matches
SELECT current_date =CAST (now() AS DATE) AS result
FROM input
ORDERBY id
Tableau
Tempting SQL
SQL that matches
true
false
true
true
false
true
true
false
true
true
false
true
true
false
true
true
false
true
true
false
true
true
false
true
true
false
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.
Snowflake
SELECT Due <CURRENT_DATE() AS result
FROM input
ORDERBY id
[Due] >= DATEADD('day', -30, TODAY()); in SQL Due >= current_date - INTERVAL 30 DAY.
Whose date is TODAY?
The local system date. Tableau's help notes that on a live connection the system date may be in another time zone; DuckDB's current_date follows the session's TimeZone setting.
How is TODAY different from NOW?
TODAY is a date (midnight); NOW is a date-time with the current time. DATE(NOW()) equals TODAY().