Joining DataLens data

DataLens uses a connection to retrieve data from a source. You can create datasets, charts, and selectors from the connection data. If the source has multiple tables, you can join them to build the required set of data. You can link data from different datasets at the chart level or through selector links.

Data joining methods

You can use different data joining methods:

Dataset level

To join data at the dataset level, you can add tables to the workspace or write an SQL query.

Warning

You cannot join data from different sources at a single dataset level.

Adding tables

You can join data through the dataset creation interface by dragging tables to the workspace and configuring links between them using the JOIN operator.

SQL query

In a dataset, you can add an ad-hoc SQL query to the data source. When accessing a data source, the query code is run as a subquery. You can use the output of the query as final dataset data or combine it with other source tables via the interface.

Chart level

To combine data at the chart level, you can use a QL chart.

Selector link level

You can add a selector to a dashboard to modify query output in its associated widgets:

  • On the dashboard, selectors and charts built from a single dataset get linked automatically.
  • Selectors and charts built from different datasets can be linked manually using aliases.

Before creating a link, make sure the field used by the selector as a filter is included in the dataset the chart is built from. Otherwise, the link will not work. For more information, see the instructions Creating an alias.