Define OLAP table references and many-to-many cardinality
Introduction
Use this how-to to define a relationship between two Data Warehouse (DWH) tables, select its cardinality and join, map the participating columns, and save the reference. When the relationship is needed in an OLAP analytical model, assign the saved reference to the relevant analytical table column.
For a many-to-many relationship, select ManyToMany when multiple rows on each side can match. The intended outcome is a saved definition that describes your tables and relationship, with an OLAP assignment when required.
Screenshot examples: the object names, schemas, expressions, and selections illustrate the interface. Use the objects and relationship design required by your own Data Warehouse (DWH) project. The captions identify examples that do not form a consistent relationship.
Applicability
This workflow starts from an existing object in the Data Mart Layer (DM), shown as Datamart layer in the diagram. It covers creating a table reference and assigning an existing column reference for OLAP use. The 2-sided setting applies to tabular OLAP models only.
The task ends with saved reference and table definitions. Generating, deploying, and processing the analytical model are separate tasks; saved cardinality alone does not establish correct many-to-many aggregation.
Prerequisites
3.1. An open Data Warehouse (DWH) project containing the analytical object and both tables to relate.
3.2. A known relationship design: the schema and name of each table, which table is side 1 and side 2, the participating columns, and the expected number of matching rows on each side.
3.3. A decision about which unmatched rows the join must retain. If the design uses expressions or aliases, their complete, validated values must be available for the selected objects.
3.4. For OLAP assignment, the target analytical table column and the intended relationship design. For many-to-many reporting, representative keys and expected totals must be available for later model validation.
Steps
Select the analytical object
In the dataflow diagram, locate the intended object under Datamart layer and right-click it. This area contains the analytical objects in the Data Mart Layer (DM). Check the object's schema and name before opening its context menu.
Expand the References menu
Point to References in the object's context menu to expand the submenu.
Open the reference definition
Click Add reference. The reference definition opens.
Select both tables and their aliases
On the reference page, Table 1 and Table 2 identify the two sides of the relationship. Each row has a schema selection followed by a table selection. Select the schema and table for each side before choosing the direction of the cardinality and join.
If your validated relationship expression uses aliases, enter each alias in the Alias field beside the corresponding table. An alias is the identifier used to refer to that table in an expression; use the same identifier consistently. If the design does not use aliases, leave these fields blank.
Check: both schema and table names must identify the intended objects. The pictured schema STAR and table DIM_Categories are examples, not required selections.
Select the cardinality and join
In Cardinality, select the value that describes how many rows can match between the tables selected in Select both tables and their aliases. The direction is from Table 1 to Table 2. For the many-to-many task, select ManyToMany after confirming that neither side is unique under the relationship key.
- OneToOne — Each side has at most one matching row under the intended relationship key.
- OneToMany — One row on Table 1 can match multiple rows on Table 2.
- ManyToOne — Multiple rows on Table 1 can match one row on Table 2.
- ManyToMany — Multiple rows on both sides can match. Validate the intended model and aggregation behavior; selecting this label alone does not prove a correct many-to-many analytical design.
- Unknown — The relationship cardinality has not been specified. Do not use it as evidence of key uniqueness.
In Join, select how the tables should be combined. Base this choice on whether the result needs only matching rows or also rows that have no match. A join does not establish the uniqueness described by Cardinality.
- INNER JOIN — Retains matching combinations from both sides.
- LEFT JOIN — Retains Table 1 rows, with matching Table 2 data where available.
- RIGHT JOIN — Retains Table 2 rows, with matching Table 1 data where available.
- FULL JOIN — Retains rows from both sides, including unmatched rows.
- CROSS JOIN — Combines every row from one side with every row from the other; it is not a key-based match.
Example: when every row in Table 1 must remain even if Table 2 has no match, LEFT JOIN expresses that requirement. This is separate from whether each Table 1 row matches one or several Table 2 rows.
Enter the relationship expression when required
If your relationship design includes a complete expression, enter it in Reference Statement. This field holds the relationship expression. Check every table identifier, alias, and column against the objects selected in Select both tables and their aliases. For a design based only on column mappings, continue to Map the participating columns without entering an expression here.
Expression example: the pictured text compares Orders.CustomerID with Customers.CustomerID and also compares their CompanyID values. The AND requires both comparisons to hold. However, the capture selects DIM_Categories and DIM_Calendar, so the pictured expression is not a valid template for those selected tables. Use the validated expression for your actual relationship.
Map the participating columns
In the Columns grid, select the relationship column from Table 1 in Column1 and its corresponding column from Table 2 in Column2, on the same row. Repeat for each column pair required by the relationship design. Match columns by their business meaning and compatible values, not merely by their names or positions in the list.
If the validated design includes an expression for a particular side of a pair, enter the complete expression in Statement1 for Table 1 or Statement2 for Table 2. Leave a statement cell blank when no expression is required for that side. Keep any aliases consistent with Select both tables and their aliases.
Check: the pictured CategoryID/CurrentDate pair does not demonstrate a meaningful key relationship. Confirm that each selected pair relates the intended records and that all parts of a multi-column relationship are included.
Review and save the reference
Review the selected tables, aliases, cardinality, join, expressions, and column pairs. Check Description so that it identifies the intended relationship; if it needs clarification, enter a meaningful description.
Inheritance concerns how references are inherited by dependent objects. Its choices are Default, No inherit, and Force inherit. If the task includes an inheritance change, use the choice specified by the project's relationship design; otherwise leave the current selection unchanged. The pictured Default selection is an example, not a universal requirement.
If Used in transformations lists existing uses, review the displayed Schema and Transformation columns to identify the affected objects. A Transformation combines input objects and applies processing logic to produce a reusable result. This list provides usage information; it does not show whether a Transformation has executed.
Click Save at the bottom of the reference page. Verify the saved definition as described in Expected Results.
Assign the saved reference for OLAP use
Follow this step when the saved relationship must be used by an analytical table column. If the task is only to define the table reference, proceed to Expected Results.
4.9.1. In the navigation tree, expand Layers, Datamart layer, and the schema containing the intended analytical table. Right-click Tables and click List tables. Find the required table by its schema and name, then double-click its row.
4.9.2. On the table's Columns tab, locate the column participating in the saved reference. Scroll horizontally if necessary to reach OLAP Reference and select the intended existing column reference.
- OLAP Reference — Selects an existing column reference for use in the analytical model. Confirm that it identifies the relationship just saved, rather than another reference involving the column.
- 2-sided — For tabular OLAP models only, selecting this checkbox requests a two-sided reference. Select it when the model design calls for a two-sided relationship; clear it when that design calls for a one-sided relationship. This setting does not select ManyToMany cardinality. For other model types, leave it unchanged.
4.9.3. Click Save on the table page to save the OLAP assignment. Repeat for other participating columns only when the relationship design requires an assignment for them.
Expected Results
The reference definition is saved for the intended tables. When Assign the saved reference for OLAP use applies, the analytical table also has the intended column reference assigned for OLAP use.
5.1. In the navigation tree, expand Layers, the relevant layer and schema, and References. Open the saved reference with Edit reference. Confirm Table 1, Table 2, their aliases, Cardinality, Join, Description, Reference Statement, Columns, and Inheritance against the intended design. For a many-to-many definition, verify that Cardinality remains ManyToMany.
5.2. For an OLAP assignment, reopen the analytical table using In the navigation tree, expand Layers, Datamart layer, and the schema containing the intended analytical table.. On Columns, confirm the saved OLAP Reference for the intended column and, for a tabular model, the intended 2-sided selection.
5.3. After the separate model generation and processing workflow, compare representative matches and totals with the expected results for the source data. For a many-to-many relationship, include keys with several matches on both sides and check for duplicated or omitted contributions to totals. Saving the reference or table definition does not perform this runtime check.
Decisions and variations
6.1 Cardinality and table order. Table 1 and Table 2 establish the direction of OneToMany, ManyToOne, LEFT JOIN, and RIGHT JOIN. If you change the table order, review those selections and the corresponding column pairs in Select both tables and their aliases, Select the cardinality and join, and Map the participating columns.
6.2 Expressions. Use the expressions specified by the validated relationship design in Enter the relationship expression when required and Map the participating columns. The presence of example text in a screenshot is not a reason to enter an expression.
6.3 OLAP assignment. A saved table reference and an OLAP column assignment are separate definitions. Assign the saved reference for OLAP use applies when the relationship is needed in the analytical model. ManyToMany describes cardinality; 2-sided requests a two-sided reference for a tabular model. One setting does not imply the other.
Troubleshooting
- Required object is missing — Confirm the Data Warehouse (DWH) project and both schema selections in Select both tables and their aliases. If a table list is filtered, check its search criteria before selecting another object. For a missing OLAP Reference, confirm that the reference was saved and includes the column you are editing.
- Save is unavailable or fails — Read any displayed validation message and check Locked by at the top of the definition. A lock held by another user can disable Save; ask the lock owner or repository owner to resolve it. For a validation error, correct the identified field and review the tables, aliases, expression identifiers, and column pairs before saving again.
- Saved definition differs from the intended result — Reopen the definition using section Expected Results and compare the saved settings with the intended design. If later model totals differ, review the matching keys, cardinality, join, and OLAP assignment. Do not change to ManyToMany or enable 2-sided solely to make an unexpected total disappear; validate the relationship against the intended records and totals.