How to pivot average aggregate window when some columns are in error

Hi,

I have a recurring issue/request from my team where they need 15min averages of tabular data that is stored in InfluxDB. Currently, I am exporting the 15-min averages with a Flux query, and then pivoting the table in Excel to put it in proper tabular form, e.g.

Timestamp Field A Field B Field C
2024-06-15 8:00:00 47.6 true 4
2024-06-15 8:15:00 49.5 true 5
2024-06-15 8:30:00 48.2 true 5
2024-06-15 8:45:00 49.2 false 6
2024-06-15 9:00:00 51.3 true 5

The query that should work is as follows:

from(bucket: "bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "measurement")
  |> aggregateWindow(every: 15m, fn: mean, createEmpty: true)
  |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> drop(columns: ["_measurement","_start","_stop"])

However, I am getting the following error:

 unsupported input type for mean aggregate: boolean

It appears that, since some of the data is not in numerical form (float/int), the query breaks down completely when attempting to pipe the results from the aggregate into a pivot table.

Is there a way I can skip, or ignore, the errors (e.g. string and bool columns) in flux, so that I can export a CSV in the correct format, or am I doomed to always need Excel to finish the job for me?

Thanks,
Francis

I don’t think you can skip this error