Multi-value variable: How to avoid merging fields?

  • What Grafana version and what operating system are you using?
    Grafana v10.0.10

  • What are you trying to achieve?
    I lack the terminology to properly explain, so let me use an image to illustrate. Basically, I want the bottom graph to exactly like the top graph. I will try to explain what’s going on below.


    These are time-series graphs.

The top graph plots temperatures of two machines chosen from variables ‘MachinoNo’ and ‘MachineNo2’. It uses two identical queries. ‘A’ queries ‘MachineNo’, ‘B’ queries ‘MachineNo2’. The two variables are copies of each other, and contain the exact same list of machines to choose from.

In the bottom graph, I’ve attempted to achieve the same thing in one query, by selecting the two machines from a third variable copy, in-which multi-value selection has been enabled. The result is similar, but instead of two graphs, I get one graph bouncing back and forth between the real temperature values (like some kind of seismic signal). I suppose instead of one column for every original source, each similar “type” have become merged somehow… (In the image I’ve highlight one temperature pair (purple), for a clearer view, but they are all like this)

Is it possible to “untangle” these unfortunate pairs?

Top table is created with two queries like this:

SELECT 
  time_bucket('20 sec', time) AS time, --timestamp interval
  part AS metric, --temperature sensor
  AVG(value) --sensor value
FROM temp --temperature database
WHERE
  $__timeFilter(time)  --selectable time window
    AND value <> 0 
      AND temp.machineno = '$MachineNo'  --Query B uses '$MachineNo2'
GROUP BY time, part
ORDER BY time

Bottom table is created with this near identical query:

SELECT 
  time_bucket('20 sec', time) AS time,
  part AS metric, --temperature sensor
  AVG(value)  --sensor value
FROM temp --temperature database
WHERE
  $__timeFilter(time) --selectable time window
    AND value <> 0 
      AND temp.machineno IN ($MultiVariable)
GROUP BY time, part
ORDER BY time
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    No

Right above the query name A or B there is a selection for Format. What have you picked?

The selected format is ‘Time series’ for all three queries.

1 Like

It looks like you have selected only one metric based on the legend. You can filter in and filter out metrics by clicking the legends.

Yes. I did that because I thought it would make the problem look a bit clearer.

This is what it looks like with all metrics shown:

The blue graphs are merged together, the purple ones together, the green and so on… The top panel looks like some kind of envelope of the bottom panel. I don’t want that. I want both to look like the top panel.

Having a single drop-down variable to select all the machines need (as many as I want), and have all their respective temperatures shown seperately and correctly, would be much more convenient then the method used for the top panel (which is very rigid and limited to two machines).

PS (At around 14:30 one of the selected machines must have been offline (and something weird is going on with its oil), but this can be ignored. It’s unrelated)