Simple math, can't crack it

Hi, I have a result returned form a query attached. I would like to divide the PassedStackCount2 field by the Loadercycle field. I really can’t figure out how to do it,any help would be greatly appreciated.

Since those are in two separate tables, you’ll need to join them into a single table (w/ the group command) and then you could pivot them to get them into a single row:

  |> group()
  |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")

That should give you one table with new columns (LoaderCycleCount2 and PassedStackCount2).

(FWIW, if this is inside some other processing steps, that “group” command with no arguments is a potential performance hit; if you’ve only got a few items, no big deal, if this is processing 1000s of values, YMMV)

1 Like

Hi John

Thank you, I had tried the pivot as you suggested but not with the group before Thank you kindly :pray:

1 Like

The Influx data model definitely takes some getting used to – glad it worked!

1 Like