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 | The output name of the field to round. Defaults to the same as the input field. | |
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 | |||
Examples
Basic Rounding
Round a number to the nearest decimal
logscale
round(myvalue)
In detail:
Rounds the number in myvalue
logscaleround(myvalue)
Rounding to n Decimal Places
To round a number to a specific number of decimal points, use
format()
rather than
round()
logscale
format("%.2f", field=value)
In detail:
Round the field value to two decimal places.
logscaleformat("%.2f", field=value)
When using format()
rounding, rounding is performed using standard math rules.
Rounding within a Timechart
Round a field and display using a timechart
logscale
timechart(function=max(value))
| round(_max, how=floor)
In detail:
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)