COT(number) is the cotangent, 1 divided by the tangent, of an angle in radians: COT(PI()/4) is 1. At 0 the cotangent is undefined and Tableau returns null. DuckDB's cot(0) raises an error and 1/tan(0) returns infinity, so guard the zero: CASE WHEN x <> 0 THEN cot(x) END.
Updated · Checked on the xmetric engine
What is the syntax?
COT(number)
number
an angle in radians.
Returns a number. Null if the input is null or the cotangent is undefined (an angle of 0).
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.
What is the cotangent of each angle?
Tableau
COT([Value])
SQL (DuckDB)
SELECTCASEWHEN Value <>0THENcot(Value) ENDAS result
FROM input
ORDERBY id