RADIANS(number) turns degrees into radians: RADIANS(180) is π. Tableau's SIN, COS and TAN take radians, so this is the usual first step for angles stored in degrees. DuckDB and Snowflake have radians(); BigQuery doesn't, so multiply by ACOS(-1) / 180. Don't hard-code 3.14.
Updated · Checked on the xmetric engine
What is the syntax?
RADIANS(number)
number
an angle in degrees.
Returns a number of radians. Null if the input is null.
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.
How many radians is each angle?
Tableau
RADIANS([Value])
SQL (DuckDB)
SELECTradians(Value) AS result
FROM input
ORDERBY id
Value is read as degrees: 16 degrees is 0.279 radians, 2.5 degrees is 0.0436.
Value
Result
2.5
0.04
−2.5
−0.04
0.13
0
−0.4
−0.01
3.75
0.07
null
0
0
16
0.28
✓ The Tableau formula and the SQL return the same 8 rows.
What is the cosine of a quantity of 45-degree steps?
Tableau
COS(RADIANS([Qty]*45))
SQL (DuckDB)
SELECTcos(radians(Qty *45)) AS result
FROM input
ORDERBY id
8 steps make a full turn: Qty 2 is 90 degrees, cosine 0 (to floating-point precision), and Qty 4 is 180 degrees, cosine -1.
Qty
Result
7
0.71
−7
0.71
10
0
9
0.71
2
0
4
−1
−1
0.71
0
1
✓ The Tableau formula and the SQL return the same 8 rows.
Where does a straight translation go wrong?
Common mistake
Why are the radians slightly off with 3.14?
Hard-coding π as 3.14 undershoots by 0.05%: 16 degrees becomes 0.27911 instead of 0.27925. Use radians() or pi().
Tableau
RADIANS([Value])
Tempting SQL
SELECT Value *3.14/180AS result
FROM input
ORDERBY id
SQL that matches
SELECTradians(Value) AS result
FROM input
ORDERBY id
Value
Tableau
Tempting SQL
SQL that matches
2.5
0.04
0.04
0.04
−2.5
−0.04
−0.04
−0.04
0.13
0
0
0
−0.4
−0.01
−0.01
−0.01
3.75
0.07
0.07
0.07
null
null
null
0
0
0
0
16
0.28
0.28
0.28
✓ 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
SELECTRADIANS(Value) AS result
FROM input
ORDERBY id