By the end of this tutorial you'll have a working star schema: the vendas (sales)
fact table linked to the produtos, clientes, filiais and calendario dimensions,
ready to slice revenue by any attribute without inflating the numbers.
If the terms "fact", "dimension" and "cardinality" are new to you, first read Dimensional modeling concepts and Relationships and cardinality.
Example workspace: Comércio Aurora Ltda (workspace aurora, dataset
prd_aurora_gold).
Prerequisites#
- An active workspace and the tables in the
prd_aurora_golddataset (or demo mode). - Tables with compatible key columns (see below).
- A role with permission to edit the model (see Roles (RBAC)).
The example tables#
| Table | Role | Key |
|---|---|---|
vendas | Fact (grain: order item) | produto_id, cliente_id, filial_id, data |
produtos | Dimension | id, categoria, marca |
clientes | Dimension | id, segmento, cidade |
filiais | Dimension | id, uf, regiao, cidade |
calendario | Time dimension | data, ano, mes, trimestre |
Step by step#
Open the model diagram
In the dashboard editor, open the semantic model diagram (see Semantic model).
Confirm the fact table
Check that
vendasis at the center. It holds the numbers you'll add up (valor,quantidade,custo).Link products
Drag from
vendas.produto_idtoprodutos.id. Cardinality N-1 (many sales to one product), filter direction single (products → sales).Link customers and branches
Repeat:
vendas.cliente_id→clientes.idandvendas.filial_id→filiais.id, both N-1 / single.Link the calendar
Link
vendas.data→calendario.data(N-1 / single). This relationship is what enables time comparisons.Mark the geographic category
In
filiais, markufas a geographic category (UF, Brazilian state) to enable the Brazil maps.Validate with a visual
Create a bar chart "revenue by
produtos.categoria" and confirm that the value crossesvendas×produtos.
Sample data (synthetic)#
vendas:
| produto_id | cliente_id | filial_id | data | valor |
|---|---|---|---|---|
| 10 | 1 | 1 | 2026-07-01 | 250 |
| 11 | 2 | 2 | 2026-07-02 | 90 |
produtos: (10, Bebidas, Marca A), (11, Limpeza, Marca B).
Expected result#
- "Revenue by category" shows Bebidas=250, Limpeza=90.
- Switching the axis to
filiais.regiaoorclientes.segmentoworks without reconfiguring anything — that's the payoff of the star. - Summing a dimension column that the join would duplicate is blocked with a warning, rather than delivered inflated (anti-fan-out protection).
Common mistakes#
- Linking by the wrong column: make sure the fact table's key points to the dimension's
identifier column (
id,data), not to some arbitrary attribute. - N-N without a bridge: if two tables are many-to-many (e.g., products × promotions), you need a bridge table — see Relationships and cardinality.
- Summing a target on the "one" side: if summing a dimension column gets blocked, the problem is the grain; sum from the correct fact table.
Next steps#
- Tutorial: calendar table for time intelligence.
- Tutorial: measures and time comparisons.
- Tutorial: sales dashboard.
Related#
Last reviewed: 2026-09-08.