DEGREES(number) turns an angle in radians into degrees: DEGREES(PI()/4) is 45. DuckDB and Snowflake have degrees(); BigQuery has no such function, so multiply by 180 / ACOS(-1). Use the full π: writing x * 180 / 3.14 drifts by about 0.05% and the results stop matching Tableau.
Updated · Checked on the xmetric engine
What is the syntax?
DEGREES(number)
number
an angle in radians.
Returns a number of degrees. 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 degrees is each angle?
Tableau
DEGREES([Value])
SQL (DuckDB)
SELECTdegrees(Value) AS result
FROM input
ORDERBY id
2.5 radians is 143.24 degrees; 16 radians is 916.73, more than two full turns.
Value
Result
2.5
143
−2.5
−143
0.13
7.16
−0.4
−22.92
3.75
215
null
0
0
16
917
✓ The Tableau formula and the SQL return the same 8 rows.
What direction does each point face, in degrees?
Tableau
DEGREES(ATAN2([Value], [Other]))
SQL (DuckDB)
SELECTdegrees(atan2(Value, Other)) AS result
FROM input
ORDERBY id
Row 8 (16 over 16) faces 45 degrees.
Value
Other
Result
2.5
4
32.01
−2.5
−3
−14
0.13
null
−0.4
−1
−158
3.75
8
25.11
2
null
0
0.5
0
16
16
45
✓ The Tableau formula and the SQL return the same 8 rows.
Where does a straight translation go wrong?
Common mistake
Why are the degrees slightly off with 3.14?
Hand-written conversions often hard-code π. 180/3.14 overshoots: 2.5 radians becomes 143.31 instead of 143.24. Use degrees() or pi().
Tableau
DEGREES([Value])
Tempting SQL
SELECT Value *180/3.14AS result
FROM input
ORDERBY id
SQL that matches
SELECTdegrees(Value) AS result
FROM input
ORDERBY id
Value
Tableau
Tempting SQL
SQL that matches
2.5
143
143
143
−2.5
−143
−143
−143
0.13
7.16
7.17
7.16
−0.4
−22.92
−22.93
−22.92
3.75
215
215
215
null
null
null
0
0
0
0
16
917
917
917
✓ 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
SELECTDEGREES(Value) AS result
FROM input
ORDERBY id