---
title: Query data with Flux
description: Guides that walk through both common and complex queries and use cases for Flux.
url: https://docs.influxdata.com/influxdb/cloud/query-data/flux/
estimated_tokens: 18378
product: InfluxDB Cloud (TSM)
version: cloud
---

# Query data with Flux

The following guides walk through both common and complex queries and use cases for Flux.

#### Example data variable

Many of the examples provided in the following guides use a `data` variable, which represents a basic query that filters data by measurement and field. `data` is defined as:

```js
data = from(bucket: "example-bucket")
    |> range(start: -1h)
    |> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "example-field")
```

## Flux query guides

-   [Query fields and tags](#query-fields-and-tags)
-   [Group](#group)
-   [Sort and limit](#sort-and-limit)
-   [Window & aggregate](#window-amp-aggregate)
-   [Explore your schema](#explore-your-schema)
-   [Transform data with math](#transform-data-with-math)
-   [Calculate percentages](#calculate-percentages)
-   [Increase](#increase)
-   [Moving Average](#moving-average)
-   [Rate](#rate)
-   [Histograms](#histograms)
-   [Fill](#fill)
-   [Median](#median)
-   [Percentile & quantile](#percentile-amp-quantile)
-   [Join](#join)
-   [Cumulative sum](#cumulative-sum)
-   [First and last](#first-and-last)
-   [Exists](#exists)
-   [Custom functions](#custom-functions)
-   [Extract scalar values](#extract-scalar-values)
-   [Monitor states](#monitor-states)
-   [Operate on timestamps](#operate-on-timestamps)
-   [Query SQL data](#query-sql-data)
-   [Conditional logic](#conditional-logic)
-   [Regular expressions](#regular-expressions)
-   [Geo-temporal data](#geo-temporal-data)
-   [Query the Flux version](#query-the-flux-version)

### [Query fields and tags](/influxdb/cloud/query-data/flux/query-fields/)

Use the [`filter()` function](/flux/v0/stdlib/universe/filter/) to query data based on fields, tags, or any other column value. `filter()` performs operations similar to the `SELECT` statement and the `WHERE` clause in InfluxQL and other SQL-like query languages.

```js
from(bucket: "example-bucket")
    |> range(start: -1h)
    |> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "example-field" and r.tag == "example-tag")
```

[Read more](/influxdb/cloud/query-data/flux/query-fields/)

### [Group](/influxdb/cloud/query-data/flux/group-data/)

Use the [`group()` function](/flux/v0/stdlib/universe/group) to group data with common values in specific columns.

```js
data
    |> group(columns: ["host"], mode: "by")
```

###### Input:

| _time | host | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | host1 | 1.0 |
| 2020-01-01T00:01:00Z | host2 | 2.0 |
| 2020-01-01T00:02:00Z | host1 | 1.0 |
| 2020-01-01T00:02:00Z | host2 | 3.0 |

###### Output:

| _time | host | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | host1 | 1.0 |
| 2020-01-01T00:02:00Z | host1 | 1.0 |

| _time | host | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | host2 | 2.0 |
| 2020-01-01T00:02:00Z | host2 | 3.0 |

[Read more](/influxdb/cloud/query-data/flux/group-data/)

### [Sort and limit](/influxdb/cloud/query-data/flux/sort-limit/)

Use the [`sort()`function](/flux/v0/stdlib/universe/sort) to order records within each table by specific columns and the [`limit()` function](/flux/v0/stdlib/universe/limit) to limit the number of records in output tables to a fixed number, `n`.

```js
data
    |> sort(columns: ["host", "_value"])
    |> limit(n: 4)
```

###### Input:

| _time | host | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | A | 1.0 |
| 2020-01-01T00:02:00Z | B | 1.2 |
| 2020-01-01T00:03:00Z | A | 1.8 |
| 2020-01-01T00:04:00Z | B | 0.9 |
| 2020-01-01T00:05:00Z | B | 1.4 |
| 2020-01-01T00:06:00Z | B | 2.0 |

###### Output:

| _time | host | _value |
| --- | --- | --- |
| 2020-01-01T00:03:00Z | A | 1.8 |
| 2020-01-01T00:01:00Z | A | 1.0 |
| 2020-01-01T00:06:00Z | B | 2.0 |
| 2020-01-01T00:05:00Z | B | 1.4 |

[Read more](/influxdb/cloud/query-data/flux/sort-limit/)

### [Window & aggregate](/influxdb/cloud/query-data/flux/window-aggregate/)

This guide walks through windowing and aggregating data with Flux and outlines how it shapes your data in the process.

```js
data
    |> aggregateWindow(every: 20m, fn: mean)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:20:00Z | 195 |
| 2020-01-01T00:40:00Z | 200 |
| 2020-01-01T01:00:00Z | 290 |
| 2020-01-01T01:20:00Z | 340 |

[Read more](/influxdb/cloud/query-data/flux/window-aggregate/)

### [Explore your schema](/influxdb/cloud/query-data/flux/explore-schema/)

Flux provides functions that let you explore the structure and schema of your data stored in InfluxDB.

```js
import "influxdata/influxdb/schema"

// List buckets
buckets()

// List measurements
schema.measurements(bucket: "example-bucket")

// List field keys
schema.fieldKeys(bucket: "example-bucket")

// List tag keys
schema.tagKeys(bucket: "example-bucket")

// List tag values
schema.tagValues(bucket: "example-bucket", tag: "example-tag")
```

[Read more](/influxdb/cloud/query-data/flux/explore-schema/)

### [Transform data with math](/influxdb/cloud/query-data/flux/mathematic-operations/)

Use the [`map()` function](/flux/v0/stdlib/universe/map) to remap column values and apply mathematic operations.

```js
data
    |> map(fn: (r) => ({ r with _value: r._value * r._value }))
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 2 |
| 2020-01-01T00:02:00Z | 4 |
| 2020-01-01T00:03:00Z | 3 |
| 2020-01-01T00:04:00Z | 5 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 4 |
| 2020-01-01T00:02:00Z | 16 |
| 2020-01-01T00:03:00Z | 9 |
| 2020-01-01T00:04:00Z | 25 |

[Read more](/influxdb/cloud/query-data/flux/mathematic-operations/)

### [Calculate percentages](/influxdb/cloud/query-data/flux/calculate-percentages/)

Use [`pivot()` or `join()`](/influxdb/cloud/query-data/flux/mathematic-operations/#pivot-vs-join) and the [`map()` function](/flux/v0/stdlib/universe/map/) to align operand values into rows and calculate a percentage.

```js
data
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(
      fn: (r) => ({
          _time: r._time,
          _field: "used_percent",
          _value: float(v: r.used) / float(v: r.total) * 100.0,
      }),
  )
```

###### Input:

| _time | _field | _value |
| --- | --- | --- |
| 2020-01-01T00:00:00Z | used | 2.5 |
| 2020-01-01T00:00:10Z | used | 3.1 |
| 2020-01-01T00:00:20Z | used | 4.2 |

| _time | _field | _value |
| --- | --- | --- |
| 2020-01-01T00:00:00Z | total | 8.0 |
| 2020-01-01T00:00:10Z | total | 8.0 |
| 2020-01-01T00:00:20Z | total | 8.0 |

###### Output:

| _time | _field | _value |
| --- | --- | --- |
| 2020-01-01T00:00:00Z | used_percent | 31.25 |
| 2020-01-01T00:00:10Z | used_percent | 38.75 |
| 2020-01-01T00:00:20Z | used_percent | 52.50 |

[Read more](/influxdb/cloud/query-data/flux/calculate-percentages/)

### [Increase](/influxdb/cloud/query-data/flux/increase/)

Use the [`increase()` function](/flux/v1/stdlib/universe/increase/) to track increases across multiple columns in a table. This function is especially useful when tracking changes in counter values that wrap over time or periodically reset.

```js
data
    |> increase()
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1 |
| 2020-01-01T00:02:00Z | 2 |
| 2020-01-01T00:03:00Z | 8 |
| 2020-01-01T00:04:00Z | 10 |
| 2020-01-01T00:05:00Z | 0 |
| 2020-01-01T00:06:00Z | 4 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:02:00Z | 1 |
| 2020-01-01T00:03:00Z | 7 |
| 2020-01-01T00:04:00Z | 9 |
| 2020-01-01T00:05:00Z | 9 |
| 2020-01-01T00:06:00Z | 13 |

[Read more](/influxdb/cloud/query-data/flux/increase/)

### [Moving Average](/influxdb/cloud/query-data/flux/moving-average/)

Use the [`movingAverage()`](/flux/v0/stdlib/universe/movingaverage/) or [`timedMovingAverage()`](/flux/v0/stdlib/universe/timedmovingaverage/) functions to return the moving average of data.

```js
data
    |> movingAverage(n: 3)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.2 |
| 2020-01-01T00:03:00Z | 1.8 |
| 2020-01-01T00:04:00Z | 0.9 |
| 2020-01-01T00:05:00Z | 1.4 |
| 2020-01-01T00:06:00Z | 2.0 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:03:00Z | 1.33 |
| 2020-01-01T00:04:00Z | 1.30 |
| 2020-01-01T00:05:00Z | 1.36 |
| 2020-01-01T00:06:00Z | 1.43 |

```js
data
    |> timedMovingAverage(every: 2m, period: 4m)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.2 |
| 2020-01-01T00:03:00Z | 1.8 |
| 2020-01-01T00:04:00Z | 0.9 |
| 2020-01-01T00:05:00Z | 1.4 |
| 2020-01-01T00:06:00Z | 2.0 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:02:00Z | 1.000 |
| 2020-01-01T00:04:00Z | 1.333 |
| 2020-01-01T00:06:00Z | 1.325 |
| 2020-01-01T00:06:00Z | 1.150 |

[Read more](/influxdb/cloud/query-data/flux/moving-average/)

### [Rate](/influxdb/cloud/query-data/flux/rate/)

Use the [`derivative()` function](/flux/v0/stdlib/universe/derivative/) to calculate the rate of change between subsequent values or the [`aggregate.rate()` function](/influxdb/cloud/reference/flux/stdlib/experimental/aggregate/rate/) to calculate the average rate of change per window of time. If time between points varies, these functions normalize points to a common time interval making values easily comparable.

```js
data
    |> derivative(unit: 1m, nonNegative: true)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:04:00Z |  |
| 2020-01-01T00:12:00Z |  |
| 2020-01-01T00:19:00Z | 10.0 |
| 2020-01-01T00:32:00Z |  |
| 2020-01-01T00:51:00Z | 4.74 |
| 2020-01-01T01:00:00Z | 5.56 |

```js
import "experimental/aggregate"

data
    |> aggregate.rate(every: 20m, unit: 1m)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:20:00Z |  |
| 2020-01-01T00:40:00Z | 10.0 |
| 2020-01-01T01:00:00Z | 4.74 |
| 2020-01-01T01:20:00Z | 5.56 |

[Read more](/influxdb/cloud/query-data/flux/rate/)

### [Histograms](/influxdb/cloud/query-data/flux/histograms/)

Use the [`histogram()` function](/flux/v0/stdlib/universe/histogram/) to create cumulative histograms with Flux.

```js
data
    |> histogram(
        column: "_value",
        upperBoundColumn: "le",
        countColumn: "_value",
        bins: [100.0, 200.0, 300.0, 400.0],
    )
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:00:00Z | 250.0 |
| 2020-01-01T00:01:00Z | 160.0 |
| 2020-01-01T00:02:00Z | 150.0 |
| 2020-01-01T00:03:00Z | 220.0 |
| 2020-01-01T00:04:00Z | 200.0 |
| 2020-01-01T00:05:00Z | 290.0 |
| 2020-01-01T01:00:00Z | 340.0 |

###### Output:

| le | _value |
| --- | --- |
| 100.0 | 0.0 |
| 200.0 | 3.0 |
| 300.0 | 6.0 |
| 400.0 | 7.0 |

[Read more](/influxdb/cloud/query-data/flux/histograms/)

### [Fill](/influxdb/cloud/query-data/flux/fill/)

Use the [`fill()` function](/flux/v1/stdlib/universe/fill/) to replace *null* values.

```js
data
    |> fill(usePrevious: true)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | null |
| 2020-01-01T00:02:00Z | 0.8 |
| 2020-01-01T00:03:00Z | null |
| 2020-01-01T00:04:00Z | null |
| 2020-01-01T00:05:00Z | 1.4 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | null |
| 2020-01-01T00:02:00Z | 0.8 |
| 2020-01-01T00:03:00Z | 0.8 |
| 2020-01-01T00:04:00Z | 0.8 |
| 2020-01-01T00:05:00Z | 1.4 |

```js
data
    |> fill(value: 0.0)
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | null |
| 2020-01-01T00:02:00Z | 0.8 |
| 2020-01-01T00:03:00Z | null |
| 2020-01-01T00:04:00Z | null |
| 2020-01-01T00:05:00Z | 1.4 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 0.0 |
| 2020-01-01T00:02:00Z | 0.8 |
| 2020-01-01T00:03:00Z | 0.0 |
| 2020-01-01T00:04:00Z | 0.0 |
| 2020-01-01T00:05:00Z | 1.4 |

[Read more](/influxdb/cloud/query-data/flux/fill/)

### [Median](/influxdb/cloud/query-data/flux/median/)

Use the [`median()` function](/flux/v0/stdlib/universe/median/) to return a value representing the `0.5` quantile (50th percentile) or median of input data.

```js
data
    |> median()
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.0 |
| 2020-01-01T00:03:00Z | 2.0 |
| 2020-01-01T00:04:00Z | 3.0 |

###### Output:

| _value |
| --- |
| 1.5 |

[Read more](/influxdb/cloud/query-data/flux/median/)

### [Percentile & quantile](/influxdb/cloud/query-data/flux/percentile-quantile/)

Use the `quantile()` function to return all values within the `q` quantile or percentile of input data.

```js
data
    |> quantile(q: 0.99, method: "estimate_tdigest")
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.0 |
| 2020-01-01T00:03:00Z | 2.0 |
| 2020-01-01T00:04:00Z | 3.0 |

###### Output:

| _value |
| --- |
| 3.0 |

[Read more](/influxdb/cloud/query-data/flux/percentile-quantile/)

### [Join](/influxdb/cloud/query-data/flux/join/)

This guide walks through joining data with Flux and outlines how it shapes your data in the process.

```js
import "join"
import "sql"

left =
    from(bucket: "example-bucket-1")
        |> range(start: "-1h")
        |> filter(fn: (r) => r._measurement == "example-m")
        |> filter(fn: (r) => r._field == "example-f")
        |> drop(columns: ["_measurement", "_field"])

right =
    sql.from(
        driverName: "postgres",
        dataSourceName: "postgresql://username:password@localhost:5432",
        query: "SELECT * FROM example_table",
    )

join.inner(
    left: left |> group(),
    right: right,
    on: (l, r) => l.sensorID == r.ID,
    as: (l, r) => ({l with expired: r.expired}),
)
    |> group(columns: ["_time", "_value"], mode: "except")
```

###### Input:

###### left

| _time | sensorID | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | 1234 | 1 |
| 2020-01-01T00:02:00Z | 1234 | 2 |
| 2020-01-01T00:03:00Z | 1234 | 1 |
| 2020-01-01T00:04:00Z | 1234 | 3 |

| _time | sensorID | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | 5678 | 2 |
| 2020-01-01T00:02:00Z | 5678 | 5 |
| 2020-01-01T00:03:00Z | 5678 | 1 |
| 2020-01-01T00:04:00Z | 5678 | 8 |

###### right

| ID | expired | serviced |
| --- | --- | --- |
| 1234 | false | 2022-01-01 |
| 5678 | true | 2022-01-01 |

###### Output:

| _time | sensorID | _value | expired |
| --- | --- | --- | --- |
| 2020-01-01T00:01:00Z | 1234 | 1 | false |
| 2020-01-01T00:02:00Z | 1234 | 2 | false |
| 2020-01-01T00:03:00Z | 1234 | 1 | false |
| 2020-01-01T00:04:00Z | 1234 | 3 | false |

| _time | sensorID | _value | expired |
| --- | --- | --- | --- |
| 2020-01-01T00:01:00Z | 5678 | 2 | true |
| 2020-01-01T00:02:00Z | 5678 | 5 | true |
| 2020-01-01T00:03:00Z | 5678 | 1 | true |
| 2020-01-01T00:04:00Z | 5678 | 8 | true |

[Read more](/influxdb/cloud/query-data/flux/join/)

### [Cumulative sum](/influxdb/cloud/query-data/flux/cumulativesum/)

Use the `cumulativeSum()` function to calculate a running total of values.

```js
data
    |> cumulativeSum()
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1 |
| 2020-01-01T00:02:00Z | 2 |
| 2020-01-01T00:03:00Z | 1 |
| 2020-01-01T00:04:00Z | 3 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1 |
| 2020-01-01T00:02:00Z | 3 |
| 2020-01-01T00:03:00Z | 4 |
| 2020-01-01T00:04:00Z | 7 |

[Read more](/influxdb/cloud/query-data/flux/cumulativesum/)

### [First and last](/influxdb/cloud/query-data/flux/first-last/)

Use the [`first()`](/flux/v0/stdlib/universe/first/) or [`last()`](/flux/v0/stdlib/universe/last/) functions to return the first or last point in an input table.

```js
data
    |> first()
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.0 |
| 2020-01-01T00:03:00Z | 2.0 |
| 2020-01-01T00:04:00Z | 3.0 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |

```js
data
    |> last()
```

###### Input:

| _time | _value |
| --- | --- |
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.0 |
| 2020-01-01T00:03:00Z | 2.0 |
| 2020-01-01T00:04:00Z | 3.0 |

###### Output:

| _time | _value |
| --- | --- |
| 2020-01-01T00:04:00Z | 3.0 |

[Read more](/influxdb/cloud/query-data/flux/first-last/)

### [Exists](/influxdb/cloud/query-data/flux/exists/)

Use the Flux `exists` operator to check if a record contains a key or if that key’s value is `null`.

##### Filter null values

```js
data
    |> filter(fn: (r) => exists r._value)
```

[Read more](/influxdb/cloud/query-data/flux/exists/)

### [Custom functions](/influxdb/cloud/query-data/flux/custom-functions/)

Create your own custom Flux functions to transform and operate on data.

```js
multByX = (tables=<-, x) => tables
    |> map(fn: (r) => ({r with _value: r._value * x}))

data
    |> multByX(x: 2.0)
```

[Read more](/influxdb/cloud/query-data/flux/custom-functions/)

### [Extract scalar values](/influxdb/cloud/query-data/flux/scalar-values/)

Use Flux dynamic query functions to extract scalar values from Flux query output. This lets you, for example, dynamically set variables using query results.

```js
scalarValue = (tables=<-) => {
    _record = tables
        |> findRecord(fn: (key) => true, idx: 0)

    return _record._value
}
```

[Read more](/influxdb/cloud/query-data/flux/scalar-values/)

### [Monitor states](/influxdb/cloud/query-data/flux/monitor-states/)

Flux provides several functions to help monitor states and state changes in your data.

### [Operate on timestamps](/influxdb/cloud/query-data/flux/operate-on-timestamps/)

Use Flux to operate on timestamps timestamps.

### [Query SQL data](/influxdb/cloud/query-data/flux/sql/)

The Flux `sql` package provides functions for working with SQL data sources. Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, SQLite, Microsoft SQL Server, Amazon Athena, and Google BigQuery.

```js
import "sql"

sql.from(
    driverName: "postgres",
    dataSourceName: "postgresql://user:password@localhost",
    query: "SELECT * FROM example_table",
)
```

[Read more](/influxdb/cloud/query-data/flux/sql/)

### [Conditional logic](/influxdb/cloud/query-data/flux/conditional-logic/)

This guide describes how to use Flux conditional expressions, such as `if`, `else`, and `then`, to query and transform data. **Flux evaluates statements from left to right and stops evaluating once a condition matches.**

```js
if color == "green" then "008000" else "ffffff"
```

[Read more](/influxdb/cloud/query-data/flux/conditional-logic/)

### [Regular expressions](/influxdb/cloud/query-data/flux/regular-expressions/)

This guide walks through using regular expressions in evaluation logic in Flux functions.

```js
data
    |> filter(fn: (r) => r.tag =~ /^foo[1-3]/)
```

###### Input:

| _time | tag | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | foo1 | 1.0 |
| 2020-01-01T00:02:00Z | foo5 | 1.2 |
| 2020-01-01T00:03:00Z | bar3 | 1.8 |
| 2020-01-01T00:04:00Z | foo3 | 0.9 |
| 2020-01-01T00:05:00Z | foo2 | 1.4 |
| 2020-01-01T00:06:00Z | bar1 | 2.0 |

###### Output:

| _time | tag | _value |
| --- | --- | --- |
| 2020-01-01T00:01:00Z | foo1 | 1.0 |
| 2020-01-01T00:04:00Z | foo3 | 0.9 |
| 2020-01-01T00:05:00Z | foo2 | 1.4 |

[Read more](/influxdb/cloud/query-data/flux/regular-expressions/)

### [Geo-temporal data](/influxdb/cloud/query-data/flux/geo/)

Use the Flux Geo package to filter geo-temporal data and group by geographic location or track.

```js
import "experimental/geo"

sampleGeoData
    |> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
    |> geo.groupByArea(newColumn: "geoArea", level: 5)
```

[Read more](/influxdb/cloud/query-data/flux/geo/)

### [Query the Flux version](/influxdb/cloud/query-data/flux/flux-version/)

Use `runtime.version()` to return the version of Flux installed in InfluxDB Cloud.

```js
import "array"
import "runtime"

array.from(rows: [{version: runtime.version()}])
```

[Read more](/influxdb/cloud/query-data/flux/flux-version/)

[flux](/influxdb/cloud/tags/flux/) [query](/influxdb/cloud/tags/query/)
