ROUND Function

Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round.

When rounding to nearest integer, decimal values that are X.5 or more are rounded to X+1.

Basic Usage

Numeric literal example:

derive type:single value: ROUND(2.5)

Output: Generates a column with each row's value 3.

Expression example:

derive type:single value: ROUND(MyValue + 2.5)

Output: Generates a column containing the nearest integer to the sum of 2.5 and the value in the MyValue column.

ROUND - Round a decimal value to the nearest Integer or to a specified number of digits. See ROUND Function.

TRUNC - Round a value down to the nearest Integer value. See TRUNC Function.

Source:

In the following example, a company produces 10 circular parts, the size of which is measured in each product's radius in inches.

prodId

radius_in

p001

1

p002

2

p003

3

p004

4

p005

5

p006

6

p007

7

p008

8

p009

9

p010

10

Based on the above data, the company wants to generate some additional sizing information for these circular parts, including the generation of two points along each part's circumference where quality stress tests can be applied.

Transform:

To begin, you can use the following steps to generate the area and circumference for each product, rounded to three decimal points:

For quality purposes, the company needs two tests points along the circumference, which are generated by calculating two separate random locations along the circumference. Since the RANDBETWEEN function only calculates using Integer values, you must first truncate the values from circumference_in: