Reference to the round() function

Summary

round(<expression>)

Returns the nearest integer for each data value in the time series described by the expression.

Parameters

ParameterDescription
expression Expression describing the time series to return rounded values for.

Description

The round() function returns the nearest integer for each data value in the time series described by the expression, by mapping any data value with a fractional part to the integer that is closest in value.

The nearest integer is computed as follows:

Sample query with round()Sample resultInput data valueReturned value (nearest integer)
round(1.75) 2 Positive, with fractional part > 0.5Integer with the next higher absolute value
round(-1.75)-2 Negative, with fractional part > 0.5Integer with the next higher absolute value
round(1.25)1 Positive, with fractional part < 0.5Integer with the next lower absolute value
round(-1.25)-1 Negative, with fractional part < 0.5Integer with the next lower absolute value
round(0.5)1 Positive, with fractional part = 0.5Integer with the next higher value (round half up technique)
round(-0.5)0 Negative, with fractional part = 0.5Integer with the next higher value (round half up technique)

round() returns a separate series of results for each time series described by the expression.

Examples

Here’s a query that returns a time series that reports positive fractional values between .2 and 1.2. round before

Now we apply round() to our original query. Notice that the values below .5 are mapped to 0, and the values between .5 and 1.2 are mapped to 1.

round after

See Also

ceil()

floor()