Each example runs on the same 6 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
What is each backup count, with blanks as 0?
Tableau
IFNULL([Backup], 0)
SQL (DuckDB)
SELECT coalesce(Backup, 0) AS result
FROM input
ORDER BY id
Rows 2 and 5 have no backup, so they show 0.
✓ The Tableau formula and the SQL return the same 6 rows.
How do I fall back to another field?
Tableau
IFNULL([Backup], [Score])
SQL (DuckDB)
SELECT coalesce(Backup, Score) AS result
FROM input
ORDER BY id
Row 2 has no backup, so it takes its score, 80.
| Score | Backup | Result |
|---|
| 92 | 10 | 10 |
| 80 | | 80 |
| 50 | 7 | 7 |
| 4 | 4 |
| 45 | | 45 |
| 80 | 3 | 3 |
✓ The Tableau formula and the SQL return the same 6 rows.
How do I label missing seasons?
Tableau
IFNULL([Season], 'Unknown')
SQL (DuckDB)
SELECT coalesce(Season, 'Unknown') AS result
FROM input
ORDER BY id
Row 5 has no season.
| Season | Result |
|---|
| Summer | Summer |
| Winter | Winter |
| Spring | Spring |
| Summer | Summer |
| Unknown |
| Winter | Winter |
✓ The Tableau formula and the SQL return the same 6 rows.