Short answer: DAX math functions round (ROUND, MROUND, INT, TRUNC, CEILING, FLOOR), divide (DIVIDE, MOD, QUOTIENT), raise powers and logs (POWER, SQRT, EXP, LN, LOG), make random numbers (RAND, RANDBETWEEN), convert types (CONVERT, CURRENCY) and do trigonometry (SIN, COS, ATAN and more). They work like Excel's functions of the same name, with one difference to remember: negative numbers round differently in INT and TRUNC, and in CEILING and ISO.CEILING.
Which functions round?
| Function | Example | Result |
|---|---|---|
| ROUND ( n, digits ) | ROUND ( 1234.567, 1 ) | 1234.6 |
| ROUND with negative digits | ROUND ( 1234.567, -2 ) | 1200 |
| ROUNDUP ( n, digits ) | ROUNDUP ( 1234.561, 2 ) | 1234.57 |
| ROUNDDOWN ( n, digits ) | ROUNDDOWN ( 1234.567, 0 ) | 1234 |
| MROUND ( n, multiple ) | MROUND ( 1.3, 0.2 ) | 1.4 |
| INT ( n ) | INT ( -2.5 ) | -3 (down to the next integer) |
| TRUNC ( n [, digits] ) | TRUNC ( -2.5 ) | -2 (cuts the decimals) |
| CEILING ( n, significance ) | CEILING ( 4.42, 0.05 ) | 4.45 |
| FLOOR ( n, significance ) | FLOOR ( 4.42, 0.05 ) | 4.4 |
| ISO.CEILING ( n [, significance] ) | ISO.CEILING ( -4.3, 2 ) | -4 |
| EVEN, ODD | EVEN ( 1.5 ), ODD ( 1.5 ) | 2, 3 |
Microsoft notes CEILING follows Excel and ISO.CEILING the ISO definition; they agree for positive numbers. MROUND errors when the number and the multiple have different signs.
Round in the last step of a measure, or better not at all and let the format string show fewer decimals: rounding each row before summing changes totals.
-- price bands of 50 for a histogram column
Price Band = FLOOR ( 'Product'[List Price], 50 )Which functions divide?
| Function | Example | Result |
|---|---|---|
| DIVIDE ( a, b [, alt] ) | DIVIDE ( 10, 0 ) | BLANK |
| MOD ( n, d ) | MOD ( 17, 5 ) | 2 |
| MOD with a negative number | MOD ( -3, 2 ) | 1 (the sign of the divisor) |
| QUOTIENT ( a, b ) | QUOTIENT ( 17, 5 ) | 3 |
| GCD, LCM | GCD ( 12, 18 ), LCM ( 4, 6 ) | 6, 12 |
-- every 7th day flag
Is Week Start = MOD ( 'Date'[Day Index], 7 ) = 0
-- hours and minutes from minutes
Duration Label = QUOTIENT ( [Minutes], 60 ) & "h " & MOD ( [Minutes], 60 ) & "m"In depth: DIVIDE.
Which functions do powers, logs and signs?
| Function | Example | Result |
|---|---|---|
| POWER ( n, p ) or n ^ p | POWER ( 1.05, 3 ) | 1.157625 |
| SQRT ( n ) | SQRT ( 16 ) | 4 |
| SQRTPI ( n ) | SQRTPI ( 1 ) | 1.7725 (square root of n times pi) |
| EXP ( n ) | EXP ( 1 ) | 2.71828 |
| LN ( n ) | LN ( EXP ( 2 ) ) | 2 |
| LOG ( n [, base] ) | LOG ( 8, 2 ) | 3 |
| LOG10 ( n ) | LOG10 ( 1000 ) | 3 |
| ABS ( n ) | ABS ( -12 ) | 12 |
| SIGN ( n ) | SIGN ( -12 ) | -1 |
| FACT ( n ) | FACT ( 5 ) | 120 |
| PI ( ) | PI ( ) | 3.14159 |
-- compound annual growth rate over the selected years
CAGR =
VAR FirstY = [First Year Revenue]
VAR LastY = [Last Year Revenue]
VAR Years = DISTINCTCOUNT ( 'Date'[Year] ) - 1
RETURN IF ( Years > 0, POWER ( DIVIDE ( LastY, FirstY ), 1 / Years ) - 1 )Which functions convert, randomise and do trigonometry?
| Function | Example | Result |
|---|---|---|
| CONVERT ( value, type ) | CONVERT ( "42", INTEGER ) | 42 |
| CURRENCY ( value ) | CURRENCY ( 1234.56789 ) | 1234.5679 (4 decimals) |
| RAND ( ) | RAND ( ) | a number from 0 to under 1 |
| RANDBETWEEN ( a, b ) | RANDBETWEEN ( 1, 6 ) | 1 to 6 |
| DEGREES, RADIANS | DEGREES ( PI ( ) ) | 180 |
| SIN, COS, TAN, COT | SIN ( RADIANS ( 30 ) ) | 0.5 |
| ASIN, ACOS, ATAN, ACOT | ATAN ( 1 ) | 0.7854 |
| SINH, COSH, TANH, COTH and inverses | COSH ( 0 ) | 1 |
CONVERT types are BOOLEAN, CURRENCY, DATETIME, DOUBLE, INTEGER and STRING; it errors when the value cannot convert. Trigonometry is rare in reports; one real use is distance between two coordinates (the haversine formula) for store and customer locations.
What goes wrong?
- INT on negatives.
INT ( -2.5 )is -3; useTRUNCto cut toward zero. - Rounding before summing. Sum of rounded rows differs from the rounded sum; round once at the end, or format instead.
- RAND in calculated columns. Changes on every refresh; seed data in Power Query instead.
- MROUND with mixed signs. An error; keep number and multiple the same sign.
Where can you check this?
- Microsoft Learn: Math and Trig functions (DAX)
- Microsoft Learn: CEILING function (DAX)
- Microsoft Learn: CONVERT function (DAX)
Where do you start?
Check your measures for ROUND inside an iterator and move the rounding to the format string. Statistical functions cover medians, percentiles and distributions.