Postgresql share query between panels, and filter different column in each

Hi I am trying to optimize my dashboards in a way that I think would be very useful, but I am not sure if that is possible in grafana. I was never strong with transformations and I find them little bit unintuitive. So I kindly ask for an advice on this topic.

  • What Grafana version and what operating system are you using?
    9.3.1, rocky linux 8
  • What are you trying to achieve?
    Optimaze dashboard by sharing query that selects multiple columns for more panels, showing different column of the query in each panel. It gets more complicated because I use metric as well and I would like those panels that each show a column value to also make use of metric column.
  • How are you trying to achieve it?
    I try to use transformations to achieve it, because when using dashboard as datasource I dont see any way to interact more with data in query tab.
  • What happened?
    I have tried few transformations but none led to the goal.
  • What did you expect to happen?
    I expected to find some
  • Can you copy/paste the configuration(s) that you are having problems with?
    I have a simple query:
SELECT
    time_local as "time",
    command::text as metric,
    mem_perc,
    cpu_perc
FROM pid_ts
WHERE
  $__timeFilter(time_local)
ORDER BY 1,2

I would like to pick two columns in source panel as in above query (mem_perc and cpu_perc) and then use it in two other panels each showing same results as if I would issue two separate queries like this:

SELECT
    time_local as "time",
    command::text as metric,
    mem_perc
FROM pid_ts
WHERE
  $__timeFilter(time_local)
ORDER BY 1,2

SELECT
    time_local as "time",
    command::text as metric,
    cpu_perc
FROM pid_ts
WHERE
  $__timeFilter(time_local)
ORDER BY 1,2
  • 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?
    Could not find any.