Rounds a numeric input field to the nearest integer, with an optional method to set the rounding type.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
as | string | false | Same name as input field | The output name of the field to round. |
field | string | true | The names of the field to round. [a] | |
how | string | false | round | Method used to round the number. |
Valid Values | ceil | Round up to the nearest whole number | ||
floor | Round down to the nearest whole number | |||
round | Standard rules; i.e. <0.5 rounds down, >0.5 rounds up | |||
round()
Examples
Basic Rounding
Query
round(myvalue)
Introduction
Round a number to the nearest decimal
Step-by-Step
Rounds the number in myvalue
logscaleround(myvalue)
Rounding to n Decimal Places
Query
format("%.2f", field=value)
Introduction
To round a number to a specific number of decimal points, use
format()
rather than
round()
Step-by-Step
Round the field value to two decimal places.
logscaleformat("%.2f", field=value)
Summary and Results
When using format()
, rounding is performed using standard math rules.
Rounding within a Timechart
Query
timechart(function=max(value))
| round(_max, how=floor)
Introduction
Round a field and display using a timechart
Step-by-Step
Create a
Time Chart
usingmax()
as the aggregate function for the value field.logscaletimechart(function=max(value))
Round the implied field from the aggregate
max()
using thefloor
option to round down the value.logscale| round(_max, how=floor)