Documentation

InfluxQL transformation functions

InfluxQL transformation functions modify and return values in each row of queried data.

Missing InfluxQL functions

Some InfluxQL functions are in the process of being rearchitected to work with the InfluxDB IOx storage engine. If a function you need is not here, check the InfluxQL feature support page for more information.

Notable behaviors of transformation functions

Must use aggregate or selector functions when grouping by time

Most transformation functions support GROUP BY clauses that group by tags, but do not directly support GROUP BY clauses that group by time. To use transformation functions with with a GROUP BY time() clause, apply an aggregate or selector function to the field_expression argument. The transformation operates on the result of the aggregate or selector operation.


ABS()

Returns the absolute value of the field value.

ABS(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ABS() to a field

Apply ABS() to each field

Apply ABS() to time windows (grouped by time)

ACOS()

Returns the arccosine (in radians) of the field value. Field values must be between -1 and 1.

ACOS(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ACOS() to a field

Apply ACOS() to each field

Apply ACOS() to time windows (grouped by time)

ASIN()

Returns the arcsine (in radians) of the field value. Field values must be between -1 and 1.

ASIN(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ASIN() to a field

Apply ASIN() to each field

Apply ASIN() to time windows (grouped by time)

ATAN()

Returns the arctangent (in radians) of the field value.

ATAN(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ATAN() to a field

Apply ATAN() to each field

Apply ATAN() to time windows (grouped by time)

ATAN2()

Returns the the arctangent of y/x in radians.

ATAN2(expression_y, expression_x)

Arguments

  • expression_y: Expression to identify the y numeric value or one or more fields to operate on. Can be a number literal, field key, constant, or wildcard (*). Supports numeric field types.
  • expression_x: Expression to identify the x numeric value or one or more fields to operate on. Can be a number literal, field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ATAN2() to a field divided by another field

Apply ATAN2() to each field divided by a numeric value

Apply ATAN2() to time windows (grouped by time)

CEIL()

Returns the subsequent value rounded up to the nearest integer.

CEIL(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply CEIL() to a field

Apply CEIL() to each field

Apply CEIL() to time windows (grouped by time)

COS()

Returns the cosine of the field value.

COS(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply COS() to a field

Apply COS() to each field

Apply COS() to time windows (grouped by time)

EXP()

Returns the exponential of the field value.

EXP(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply EXP() to a field

Apply EXP() to each field

Apply EXP() to time windows (grouped by time)

FLOOR()

Returns the subsequent value rounded down to the nearest integer.

FLOOR(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply FLOOR() to a field

Apply FLOOR() to each field

Apply FLOOR() to time windows (grouped by time)

LN()

Returns the natural logarithm of the field value. Field values must be greater than or equal to 0.

LN(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply LN() to a field

Apply LN() to each field

Apply LN() to time windows (grouped by time)

LOG()

Returns the logarithm of the field value with base b. Field values must be greater than or equal to 0.

LOG(field_expression, b)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.
  • b: Logarithm base to use in the operation.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply LOG() to a field with a base of 3

Apply LOG() to each field with a base of 5

Apply LOG() to time windows (grouped by time)

LOG2()

Returns the logarithm of the field value to the base 2. Field values must be greater than or equal to 0.

LOG2(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply LOG2() to a field

Apply LOG2() to each field

Apply LOG2() to time windows (grouped by time)

LOG10()

Returns the logarithm of the field value to the base 10. Field values must be greater than or equal to 0.

LOG10(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply LOG10() to a field

Apply LOG10() to each field

Apply LOG10() to time windows (grouped by time)

POW()

Returns the field value to the power of x.

POW(field_expression, x)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.
  • x: Power to raise to.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply POW() to a field with a power of 3

Apply POW() to each field with a power of 5

Apply POW() to time windows (grouped by time)

ROUND()

Returns a field value rounded to the nearest integer.

ROUND(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply ROUND() to a field

Apply ROUND() to each field

Apply ROUND() to time windows (grouped by time)

SIN()

Returns the sine of a field value.

SIN(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply SIN() to a field

Apply SIN() to each field

Apply SIN() to time windows (grouped by time)

SQRT()

Returns the square root of a field value. Field values must be greater than or equal to 0. Negative field values return null.

SQRT(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply SQRT() to a field

Apply SQRT() to each field

Apply SQRT() to time windows (grouped by time)

TAN()

Returns the tangent of the field value.

TAN(field_expression)

Arguments

  • field_expression: Expression to identify one or more fields to operate on. Can be a field key, constant, or wildcard (*). Supports numeric field types.

Notable behaviors

Examples

The following examples use the Random numbers sample data.

Apply TAN() to a field

Apply TAN() to each field

Apply TAN() to time windows (grouped by time)


Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.