Skip to content

Lesson 14 ยท Joins and Data Modeling

Data Models, Relationships and Metrics

Build trusted shared sources in Sigma with data models, many-to-one relationships and reusable metrics, publish them carefully and move away from datasets.

If every analyst joins tables their own way, "revenue" will have five meanings. A data model gives shared logic one home. Workbooks use it as a source, so everyone starts from the same tables, names and calculations.

What a data model contains

According to Sigma's documentation, a data model is a collection of table and input table elements that workbooks and other data models can use as sources. The elements can come from the data platform, a CSV upload, custom SQL or another data model. You can also add child elements, controls, column groupings and aggregations.

About datasets: Sigma's older "datasets" have been replaced. According to its documentation (checked December 2026), since June 2, 2026 you cannot create or edit datasets, and since September 15, 2026 you cannot use them as a data source. If you find old material about datasets, follow Sigma's migration guidance to data models.

Design the model

Start from questions, not from tables. A good model often follows a star shape: a detailed fact table (orders, events) linked to dimension tables (customers, products, dates). The data warehousing tutorial explains this idea in more depth.

flowchart LR
  F["Order lines (fact)"] --> P["Products"]
  F --> C["Customers"]
  F --> D["Calendar"]

Many fact rows point to one row in each dimension.

Relationships

A relationship defines how a source table connects to a target table. The documentation says that Sigma supports many-to-one and one-to-one relationships:

  • The source should be the more detailed table (for example order lines).
  • The target should have one row per key (for example products).
  • Relationships are directional.
  • Both elements must be on the same connection and in the same data model.
  • You must publish the model to make the relationship available to others.

Sigma does not create relationships automatically, even if your database has primary and foreign keys. And a relationship does not join the tables immediately: the join runs only when someone adds a related column. This can reduce unnecessary joins.

If a target key is not unique, the join can fan out and give wrong results. Test uniqueness before you define the relationship.

SQL Stand-in: check that a dimension key is unique

Press Run (or Ctrl + Enter) to see the result here.

If the two numbers differ, fix the dimension before you rely on it.

Metrics

Sigma describes a metric as a reusable aggregate calculation for data elements that share a data source. In a data model, you define metrics in an element's modeling settings with a name, an optional description and a formula. Formulas can use functions, table columns and other metrics. Metrics need an aggregate; if a preview is empty, check that the formula has one, such as Sum or Count.

TEXT
Net revenue        Sum([Gross]) - Sum([Discount]) - Sum([Refund])
Orders             CountDistinct([Order ID])
Average order      [Net revenue] / [Orders]

You can also set display formatting, and an optional timeline with a date column and comparison period. When you edit a metric and publish, the change flows to the items that use it. When you delete one, dependent items show errors.

A metric definition card

Write down each metric like this before you build it:

Field Example
Name Net revenue
Meaning Money from sales after discounts and refunds, without tax
Formula Sum([Gross]) - Sum([Discount]) - Sum([Refund])
Grain Order line
Excludes Test orders, internal accounts
Owner Finance analytics team
Python Stand-in: one metric definition reused by two reports

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Both reports and the total agree because they use one function.

Publishing and access

Publishing a model saves new or changed reusable elements. If changes could make columns unavailable to documents that use the model, Sigma asks you to validate the affected content. Treat model changes like code changes: note what changed and warn users about renamed or removed columns.

To create or edit models you need an account permission and ownership or Can edit access. You share a model with Can view (use it) or Can edit (use and change it). An element can also be hidden as a source while staying on the model page. Sigma also documents ways to manage data models as code, which can help with review and version control.

Good modeling habits

  • Use business names, not raw column names.
  • Add descriptions to columns and metrics.
  • Hide technical columns from users.
  • Keep one owner and a change log.
  • Test totals after each change.

Common mistake: putting every possible table into one huge model. It becomes hard to find things and easy to join wrongly. Make focused models around business areas.

Changing a model safely

Before you rename or remove a column, find out which documents use it. Make the change, validate the affected content, and compare a few important totals before and after. When a definition changes, such as what counts as revenue, announce the date and the reason, because historical charts may change too.

Test a metric before you publish it

Choose a short period and a small slice of data that you can verify by hand or with a trusted query. Compute the metric, compare the two results and explain every difference. Then view the metric by several dimensions, such as region and month. A ratio should be recalculated correctly at each level, and a metric built on distinct counts may not add up across groups. Add that note to the metric description.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which relationship shapes does Sigma document for data models?

    The detailed source points at a target with one row per key.
  2. 2. When does the join from a relationship run?

    The relationship defines logic; the join happens when it is needed.
  3. 3. What is a metric?

    Metrics give a shared definition to aggregate values.
  4. 4. What does the documentation say about datasets after September 15, 2026?

    Creation and editing stopped in June, and use as a source stopped in September 2026.

Summary

  • A data model gives shared tables, relationships and metrics one home.
  • Check target key uniqueness before defining a relationship.
  • Metrics are reusable aggregates; document meaning and owner.
  • Publish changes carefully because other documents depend on them.
  • Datasets are retired; use data models.

Next: Charts and KPIs

Your progress is saved in this browser. No account needed.