Skip to main content

Celonis Product Documentation

ROUND
Description

The ROUND function rounds a numeric value to the closest number.

It can be applied to FLOAT columns or INT columns. The result is a column of type FLOAT if precision is specified. INT otherwise.

Floats exactly in the middle between two values are rounded to the next absolute bigger value (see example).

Syntax
  ROUND ( column [, precision ] )
 
  • column: The input column where values should be rounded. Supported input type: FLOAT

  • precision: The number of decimal places to round input values to (can be negative)

NULL handling

If the input value is NULL, the result is NULL as well.

Example

[1]

ROUND of positive FLOATs, negative FLOAT and a NULL value:

Query

Column1

         ROUND ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : float

1.1

1.4

1.6

-1.1

null

Result

Column1 : int

1

1

2

-1

null

[2]

Round with precision returns a FLOAT.

Query

Column1

         ROUND ( "Table1"."Column1" , 1 )
        

Input

Output

Table1

Column1 : float

1.14

1.16

-1.13

null

Result

Column1 : float

1.1

1.2

-1.1

null

[3]

Ties are rounded away from zero:

Query

Column1

         ROUND ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : float

1.5

-1.5

Result

Column1 : int

2

-2

[4]

ROUND has no effect on an INT column:

Query

Column1

         ROUND ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : int

1

2

3

-1

null

Result

Column1 : int

1

2

3

-1

null

[5]

Ties are rounded away from zero:

Query

Column1

         ROUND ( "Table1"."Column1" , 2 )
        

Input

Output

Table1

Column1 : float

1.115

-1.115

Result

Column1 : float

1.12

-1.12

[6]

Negative precision round the value to the specified position before the comma. If the value has fewer digits before the comma than precision, the result is 0.0.

Query

Column1

         ROUND ( "Table1"."Column1" , - 2 )
        

Input

Output

Table1

Column1 : float

1.2

12.0

123.0

100.0

1999.0

1199.0

Result

Column1 : float

0.0

0.0

100.0

100.0

2000.0

1200.0

See also: