How to get the data back as a single consumable table

I would like to return all the data for a single measurement given a filter as a single consumable “table”.
How does one achieve this in flux?

 from(bucket:"example-bucket")
  |> range(start:-72h)
  |> filter(fn: (r) => r._measurement == ${measurement})
  |> filter(fn: (r) => r.tag1== ${filtervalue})
  |> yield(name: ${measurement})`;

I want the result to look like:
_time, measurement, tag1, .. tagn, field1, .. fieldn

I tried the following but I seem to be missing data points

from(bucket:"example-bucket")
|> range(start:-72h)
|> filter(fn: (r) => r._measurement == ${measurement})
|> filter(fn: (r) => r.tag1== ${filtervalue})
|> pivot(columnKey: ["_field"], rowKey: ["_time"], valueColumn: "_value")
|> group(columns: ["measurement"])
|> drop(columns: ["table", "_start", "_stop", "_measurement"])

Hello @nsk,
Please use group() to return the data in one table

1 Like