Round

round

The round function rounds a numeric value to the nearest integer or specified number of decimal places.

Spec

round(arg0, [decimals])

Parameters

arg0 - The numeric value to round.
decimals (optional) - The number of decimal places to round to. Defaults to 0.

Return Value

The rounded value.

Example

Round to nearest integer:

datatable(val:real)[1.7, 2.3, -1.8]
| extend rounded = round(val)
valrounded
1.72
2.32
-1.8-2

Round to 1 decimal place:

datatable(val:real)[1.75, 2.34]
| extend rounded = round(val, 1)
valrounded
1.751.8
2.342.3

round

Rounds numbers to the nearest integer or specified precision.

Syntax

round(Number [, Precision])
  • Precision is optional; when provided, rounds to that decimal place or power of 10.

Examples

Round to integer:

datatable(x:real)[1.2, 1.8]
| extend rounded = round(x)

Round to hundredths:

datatable(x:real)[1.234, 5.678]
| extend rounded = round(x, 0.01)