How to display values from rows as data in columns in a table (using data transformation)

Hi @misiekdp and congrats on getting the solution.

If you just want the last row returned in your query, then I think this would work:

|> last()

The yield statement is just to deliver the data, and in Grafana, it’s often not even needed (although it does not hurt anything). In Influx Data Explorer, you need to put it in, usually as the last line of your query, and it can be any word in quotes, such as:

|> yield(name: "kalamazoo")

Finally, I would suggest you change the order of the statements to be as shown and make sure your query still works with this order:

....
  |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> last()
  |> yield(name: "last")