Rounding functions

Function NameDescription
ceiling()Calculates the smallest integer greater than, or equal to, the specified numeric expression.
bin()Rounds values down to an integer multiple of a given bin size.
bin_auto()Rounds values down to a fixed-size “bin”, with control over the bin size and starting point provided by a query property.
floor()Calculates the largest integer less than, or equal to, the specified numeric expression.

ceiling()

Calculates the smallest integer greater than, or equal to, the specified numeric expression.

Arguments

  • x: A real number.

Returns

  • The smallest integer greater than, or equal to, the specified numeric expression.

Examples

ceiling(x)
ceiling(25.43) == 26

Run in Playground

bin()

Rounds values down to an integer multiple of a given bin size.

The bin() function is used with summarize operator. If your set of values are disorderly, they will be grouped into fractions.

Arguments

  • value: A date, number, or timespan
  • roundTo: The “bin size”, a number or timespan that divides value.

Returns

The nearest multiple of roundTo below value.

Examples

bin(value,roundTo)
bin(25.73, 4) == 24

Run in Playground

bin_auto()

Rounds values down to a fixed-size “bin”, the bin_auto() function can only be used with the summarize operator by statement with the _time column.

Arguments

  • Expression: A scalar expression of a numeric type indicating the value to round.

Returns

The nearest multiple of query_bin_auto_at below Expression, shifted so that query_bin_auto_at will be translated into itself.

Example

summarize count() by bin_auto(_time)

Run in Playground

floor()

Calculates the largest integer less than, or equal to, the specified numeric expression.

Arguments

  • number: A real number.

Returns

  • The largest integer greater than, or equal to, the specified numeric expression.

Examples

floor(number)
floor(25.73) == 25

Run in Playground