Relationships between datasets

Link datasets on a shared column so one chart can use fields from both.

A relationship links two datasets on a shared column, letting a single chart use fields from both.

The idea

Orders has customer_id. Customers has id and country. Relate them and you can chart revenue by country, even though revenue lives in one dataset and country in the other — the engine works out the join.

Cardinality

Which side is unique matters:

  • Many-to-one is the usual shape — many orders, one customer.
  • One-to-one means both sides are unique.

Getting this wrong is the classic cause of inflated totals: if a "one" side is not actually unique, rows multiply on the join and every sum comes back too large. If a number is mysteriously too big, check the relationship before you check the measure.

Cross-filter direction

Whether filtering one side also filters the other. Single direction is the safer default and covers most models; both directions is occasionally necessary and occasionally the reason a filter behaves in a way nobody expects.

Multiple hops

Charts can use fields across several related datasets — orders → customers → regions — as long as a path of relationships connects them. The engine finds the path; you do not describe it.

When there is no relationship

Fields from unrelated datasets cannot be combined in one visual, and that refusal is correct: with no relationship there is no defined way to line the rows up, and any number produced would be arbitrary.

Relationships between datasets · ChartBase Docs