Rounds a numeric input field to the nearest integer, with an optional method to set the rounding type.

ParameterTypeRequiredDefaultDescription
asstringfalseSame name as input fieldThe output name of the field to round.
fieldstringtrue The names of the field to round. [a]
howstringfalseroundMethod used to round the number.
  Valid ValuesceilRound up to the nearest whole number
   floorRound down to the nearest whole number
   roundStandard rules; i.e. <0.5 rounds down, >0.5 rounds up

[a] If an argument name is not given, field is the default argument.

round() Examples

Basic Rounding

Query
logscale
round(myvalue)
Introduction

Round a number to the nearest decimal

Step-by-Step
  • Rounds the number in myvalue

    logscale
    round(myvalue)

Rounding to n Decimal Places

Query
logscale
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.

    logscale
    format("%.2f", field=value)
Summary and Results

When using format(), rounding is performed using standard math rules.

Rounding within a Timechart

Query
logscale
timechart(function=max(value))
| round(_max, how=floor)
Introduction

Round a field and display using a timechart

Step-by-Step
  • Create a Time Chart using max() as the aggregate function for the value field.

    logscale
    timechart(function=max(value))
  • Round the implied field from the aggregate max() using the floor option to round down the value.

    logscale
    | round(_max, how=floor)