OpenBI Docs Buy

ROUND

A number rounded to a number of decimals (negative: to tens, hundreds…), halves away from zero.

Group: Math. Compatible with DAX.

Syntax

ROUND ( <number>, <num_digits> )
ParameterTypeDescription
numberNumberThe value whose decimals are rounded.
num_digitsWhole numberHow many decimals to keep: 0 for a whole number, a negative number for tens, hundreds and so on.

Returns

Number. The number rounded to that many decimals, a half going away from zero.

Remarks

  • A half goes away from zero: ROUND ( 2.5, 0 ) is 3 and ROUND ( -2.5, 0 ) is -3. There is no rounding to the even neighbour (banker's rounding).
  • Numbers round as they are written: ROUND ( 2.345, 2 ) is 2.35 and ROUND ( 1.005, 2 ) is 1.01, although the computer holds 1.005 as a hair less.
  • A negative num_digits rounds to the left of the decimal point: ROUND ( 1234.567, -2 ) is 1200.
  • num_digits is itself rounded to a whole number first: 0.4 means 0 decimals.
  • A blank gives BLANK. A whole number stays a whole number and a Currency value stays a Currency value.
  • Rounding every row and then adding differs from adding and then rounding: three rows of 1.4 rounded one by one add up to 3, their total 4.2 rounds to 4. Round where the number is shown.

Examples

Halves and negative digits

EVALUATE
ROW (
    "2.5", ROUND ( 2.5, 0 ),
    "-2.5", ROUND ( -2.5, 0 ),
    "2.345 to 2", ROUND ( 2.345, 2 ),
    "1234.567 to -2", ROUND ( 1234.567, -2 )
)
2.5-2.52.345 to 21234.567 to -2
3-32.351200

Rounding rows or the total

EVALUATE
VAR Amounts = DATATABLE ( "Amount", DOUBLE, { { 1.4 }, { 1.4 }, { 1.4 } } )
RETURN
    ROW (
        "Rounded rows", SUMX ( Amounts, ROUND ( [Amount], 0 ) ),
        "Rounded total", ROUND ( SUMX ( Amounts, [Amount] ), 0 )
    )
Rounded rowsRounded total
34

ROUNDUP, ROUNDDOWN, MROUND, TRUNC, FIXED.

Last updated · OpenBI Studio 0.3.74