i am trying to build a dashboard where i have multiple queries.
Query A returns the initial data i need to work with and i want query B, C and D to only rely on the data that comes from query A.
Better said, i want query B, C and D only to be executed if query A returns data.
is this possible in any way?
I tried to use query A as a variable but it returns more than the data i need in the other queries.
My goal is to build a table for servers which have a specific agent installed with some data to that agent (query A) and then i want to add some additional data from that server (query B, C and D)
Grafana does not natively support conditional query execution—meaning, you cannot directly make queries B, C, and D only execute if query A returns data. All queries in a panel are executed independently when the panel loads or refreshes.
However, there are a few approaches and features that might help you approximate your goal:
Share Query Results Across Panels
Grafana allows you to share the results of a query from one panel with other panels using the Dashboard data source. This means you can have Query A in a “source” panel, and then in other panels, use the Dashboard data source to reference the results of Query A. This reduces redundant queries and ensures B, C, and D are working with the same data as A, but it does not prevent B, C, and D from executing if A returns no data—they will still attempt to use the (possibly empty) result set from A. This can help with performance and data consistency, but not with strict conditional execution based on data presence. Share query results with another panel
Chained Variables
You can use chained variables, where the value of one variable (e.g., a list of servers with the agent installed from Query A) is used to filter the options or results in subsequent variables (for B, C, D). This is useful for filtering, but again, all queries will still execute; they will just be filtered based on the variable values. Grafana variables: what they are and how they create dynamic dashboards
4. Transformations
You can use transformations such as “Filter data by query refId” to hide or show data from specific queries in a panel, but this does not control query execution—just what is displayed. Filter data by query refId
We are using influxDB v2 with influxQL as a datasource.
One additional information:
the goal is to build a list of servers with the agent installed. Not a table where i can select each sever and get the informations from.