Documentation

Recalculate the _value column

This example uses NOAA water sample data.

Recalculate the _value column without creating a new one. Use the with operator in map() to overwrite the existing _value column.

The following query: - Uses filter() to filter the average_temperature measurement. - Uses map() to convert Fahrenheit temperature values into Celsius.

from(bucket: "noaa")
  |> filter(fn: (r) => r._measurement == "average_temperature")
  |> map(fn: (r) => ({r with _value: (float(v: r._value) - 32.0) * 5.0 / 9.0} ))
_field_measurement_start_stop_timelocation_value
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:00:00Zcoyote_creek27.77777777777778
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:06:00Zcoyote_creek22.77777777777778
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:12:00Zcoyote_creek30
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:18:00Zcoyote_creek31.666666666666668
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:24:00Zcoyote_creek25
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:30:00Zcoyote_creek21.11111111111111
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:36:00Zcoyote_creek28.88888888888889
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:42:00Zcoyote_creek24.444444444444443
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:48:00Zcoyote_creek29.444444444444443
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T00:54:00Zcoyote_creek26.666666666666668
degreesaverage_temperature1920-03-05T22:10:01Z2020-03-05T22:10:01Z2019-08-17T01:00:00Zcoyote_creek21.11111111111111
•••••••••••••••••••••

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: