Merge results with same measurment in same table-column

Hello everyone,

The following scenario:
I am collecting various devices of the same type. The collected values, e.g. temperature, are always the same. I would now like to display them in a table for each device. This works so far, but the values are not displayed one below the other, but a new column with the same name is created for each device (see attached image). How can I get the values to be displayed one below the other in a common column?

Grafana Version 10.2.0 on Ubuntu.



Example-Query for Device1:

from(bucket: “bucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “temp”)
|> filter(fn: (r) => r[“_field”] == “banktotal”)
|> filter(fn: (r) => r[“name”] == “els-bms-1”)
|> filter(fn: (r) => r[“bank”] == “1” or r[“bank”] == “2” or r[“bank”] == “3” or r[“bank”] == “4”)
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> last()

Thanks in advance!

What does your table look like before the transformation?

Like that:

It looks like you have multiple queries for multiple different devices - that’s not a good practice. Generally, you can have 1 query for multiple devices (use proper filtering) and then group by device → you won’t need any transformation then.

But even if I put it into a single query my table looks like the picture I have posted before.

So then assume that you don’t have correct query and investigate how it can be improved (I guess you need to group by name and bank - but I’m not flux expert so don’t ask me how to do that).