Hello Grafana Community,
I need some help with transforming my data into the correct form in a Grafana Table panel.
Various hours of web searching resulted in only confusion on how this should best be done.
I also used Grafana’s Grot AI helper | Grafana Labs and chatgpt, but both give me “solutions” that use non existing transformations and cause me more confusion.
What does my data look like
I have sql data that looks like the data in the following table:
Location | Device | Measurement Type | Value | Unit | Status |
---|---|---|---|---|---|
Location2 | Device1 | Ph Level | 6 | (no unit) | ok |
Location2 | Device2 | Water Temperature | 30 | °C | ok |
Location2 | Device1 | Air Temperature | 25 | °C | alarm |
Location1 | Device1 | Air Temperature | 22 | °C | ok |
Location1 | Device1 | Water Chlorine Concentration | 10 | ppm | warning |
Location1 | Device2 | Air Temperature | 10 | °C | alarm |
Short summary on the data: It contains different locations throughout the city, that have multiple devices monitored, for multiple measurements (such as air temp, water temp, water chlorine level, …).
Locations can have multiple Devices. Devices can have multiple types of measurement.
What do i want my result to look like
- The “Location” values should become column headers
- The row headers should be defined by “Device” and “Type Of Measurement”
- The cell values should contain the “Value” (if a value exists for the combination of the row/column)
- The cell should have it’s “unit” (for example °C) defined by the “unit” value from the data
- The cell should have its color defined by the “Status” value (for example, red if alarm, orange if warning, green if ok)
The resulting table should look something like this:
Column 1 | Location1 | Location2 |
---|---|---|
Device 1 - Air Temperature | 22°C | 25°C |
Device 1 - Ph Level | 6 | |
Device 1 - Water Chlorine Concentration | 10 | |
Device 2 - Air Temperature | 10°C | |
Device 2 - Water Temperature | 30°C |
Question
How can i achieve what i have described here?
Any input is appreciated.
Thanks in advance for taking the time to help me!
Kind regards,
Wesley