COS DAX Function (Math and Trig)

Returns the cosine of the given angle.

Syntax

COS ( <Number> )
Parameter Attributes Description
Number

The angle in radians for which you want the cosine.

Return values

Scalar A single decimal value.

Returns the cosine of the given angle.

Remarks

If the angle is in degrees, either multiply the angle by PI()/180 or use the RADIANS function to convert the angle to radians.

» 1 related function

Examples

--  SIN, COS, ASIN, ACOS, TAN, ATAN, COT, ACOT are the
--  standard trigonometrical functions.
--
--  Where required, the arguments are specified in radians.
DEFINE
    VAR Vals = GENERATESERIES ( -3 * PI () + 0.001, 3 * PI (), PI () / 4 )

EVALUATE
ADDCOLUMNS (
    Vals,
    "Value (nπ)",
        VAR ImproperQuartersOfPi = ROUND ( ABS ( [Value] / PI () * 4 ), 0 )
        VAR WholePis = ROUNDDOWN ( ImproperQuartersOfPi / 4, 0 )
        VAR ProperQuartersOfPi = MOD ( ImproperQuartersOfPi, 4 )
        RETURN
            IF ( ROUND ( [Value], 0 ) < 0, "-" )
                & IF ( WholePis <> 0 && ImproperQuartersOfPi <> 4, WholePis )
                & IF ( ProperQuartersOfPi <> 0, UNICHAR ( 187 + ProperQuartersOfPi ) )
                & IF ( ImproperQuartersOfPi = 0, "0", "π" ),
    "SIN", SIN ( [Value] ),
    "ASIN", ASIN ( SIN ( [Value] ) ),
    "COS", COS ( [Value] ),
    "ACOS", ACOS ( COS ( [Value] ) ),
    "TAN", TAN ( [Value] ),
    "ATAN", ATAN ( TAN ( [Value] ) ),
    "COT", COT ( [Value] ),
    "ACOT", ACOT ( COT ( [Value] ) )
)
Value Value (nπ) SIN ASIN COS ACOS TAN ATAN COT ACOT
-9.42 -3π -0.00 -0.00 -1.00 3.14 0.00 0.00 1,000.00 0.00
-8.64 -2¾π -0.71 -0.79 -0.71 2.36 1.00 0.79 1.00 0.79
-7.85 -2½π -1.00 -1.57 0.00 1.57 -1,000.00 -1.57 -0.00 1.57
-7.07 -2¼π -0.71 -0.78 0.71 0.78 -1.00 -0.78 -1.00 2.36
-6.28 -2π 0.00 0.00 1.00 0.00 0.00 0.00 1,000.00 0.00
-5.50 -1¾π 0.71 0.79 0.71 0.79 1.00 0.79 1.00 0.79
-4.71 -1½π 1.00 1.57 -0.00 1.57 -1,000.00 -1.57 -0.00 1.57
-3.93 -1¼π 0.71 0.78 -0.71 2.36 -1.00 -0.78 -1.00 2.36
-3.14 -0.00 -0.00 -1.00 3.14 0.00 0.00 1,000.00 0.00
-2.36 -¾π -0.71 -0.79 -0.71 2.36 1.00 0.79 1.00 0.79
-1.57 -½π -1.00 -1.57 0.00 1.57 -1,000.00 -1.57 -0.00 1.57
-0.78 -¼π -0.71 -0.78 0.71 0.78 -1.00 -0.78 -1.00 2.36
0.00 0 0.00 0.00 1.00 0.00 0.00 0.00 1,000.00 0.00
0.79 ¼π 0.71 0.79 0.71 0.79 1.00 0.79 1.00 0.79
1.57 ½π 1.00 1.57 -0.00 1.57 -1,000.00 -1.57 -0.00 1.57
2.36 ¾π 0.71 0.78 -0.71 2.36 -1.00 -0.78 -1.00 2.36
3.14 π -0.00 -0.00 -1.00 3.14 0.00 0.00 1,000.00 0.00
3.93 1¼π -0.71 -0.79 -0.71 2.36 1.00 0.79 1.00 0.79
4.71 1½π -1.00 -1.57 0.00 1.57 -1,000.00 -1.57 -0.00 1.57
5.50 1¾π -0.71 -0.78 0.71 0.78 -1.00 -0.78 -1.00 2.36
6.28 0.00 0.00 1.00 0.00 0.00 0.00 1,000.00 0.00
7.07 2¼π 0.71 0.79 0.71 0.79 1.00 0.79 1.00 0.79
7.85 2½π 1.00 1.57 -0.00 1.57 -1,000.00 -1.57 -0.00 1.57
8.64 2¾π 0.71 0.78 -0.71 2.36 -1.00 -0.78 -1.00 2.36

Related functions

Other related functions are:

Last update: Dec 4, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber

Microsoft documentation: https://docs.microsoft.com/en-us/dax/cos-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of COS? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.