Use Correlations Editor in Explore
Before you begin
This example shows how to create a correlation using Correlations Editor in Explore.
Correlations allow you to use results of one query to run a new query in any data source. In this example you will run a query that renders tabular data. The data will be used to run a different query that yields a graph result.
Please make sure you have setup up a test data source.
Create a new correlation
Go to Explore.
Select
test data source
.Click on “+ Add” dropdown and select “Add correlation” button.
Explore is now in Correlations Editor mode indicated by a blue border.
Select scenario:
CSV File
.Select file:
population_by_state.csv
.Note that each cell is a link that you can click on to start creating a new correlation.
Selecting the source of a correlation Create new correlation that attaches a data link in the
State
column: click on any cell in theState
column, e.g. “California”.Explore opens in split view. Select the same data source you selected in the left pane.
The helper above the query editor contains all available variables you can use the target query. Variables contain all data fields (table columns) from the selected row.
Select Scenario:
CSV Metric Values
.In the Query Editor’s
String Input
field provide variables with population values for each year:${1980},${2000},${2020}
. This will generate a graph using variable values.In the Query Editor’s
Alias
field, write${State}
Setting up the target of a correlation Run a query to see that it produces a graph using sample values from the variables.
Save the correlation using “Save” button in the top.
Test a newly created correlations
Once the correlation is saved Explore will exit Correlations Editor automatically and re-rerun the query in the left pane.
Click on a state name. Note how values from the row are inserted into the query on the right and the graph changes using the values for each row. The query is rerun with updates values every time you click on a state name.
Result of clicking on a data link
You can apply the same steps to any data source. Correlations allow you to create links in visualizations to run dynamic queries based on selected data. In this example we used data returned by a query to build a new query generating different visualization using the same data source. However, you can create correlations between any data sources to create custom exploration flows.
Correlations in the logs panel
Correlations links in the logs panel show slightly differently than the table panel. When you enter the Correlation Editor mode when looking at logs, you will need to expand a log line to see the button that serves as the correlation link.

Was this page helpful?
Related resources from Grafana Labs


