add_relationship
Create relationships between columns in Power BI semantic models, with configurable cardinality and cross/security filtering behaviors to control data joins.
Instructions
Create a relationship between two columns. Defaults to a star-schema Many->One (from = many/fact side, to = one/dimension side), but the cardinality is overridable to support 1:1, M:1, 1:M and M:M. fromCardinality/toCardinality = One | Many. crossFilteringBehavior = OneDirection | BothDirections | Automatic (overrides the bothDirections flag). securityFilteringBehavior = OneDirection | BothDirections | None. joinOnDateBehavior = DateAndTime | DatePartOnly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| active | No | make the relationship active (default true) | |
| toTable | Yes | to (one/dimension) side table | |
| toColumn | Yes | to-side column | |
| fromTable | Yes | from (many/fact) side table | |
| sessionId | Yes | ||
| fromColumn | Yes | from-side column | |
| toCardinality | No | to-side cardinality: One | Many (default One) | |
| bothDirections | No | bi-directional cross filter shortcut (default false = single direction). crossFilteringBehavior overrides this. | |
| fromCardinality | No | from-side cardinality: One | Many (default Many) | |
| joinOnDateBehavior | No | DateAndTime | DatePartOnly (for date-based joins) | |
| crossFilteringBehavior | No | OneDirection | BothDirections | Automatic (overrides bothDirections) | |
| securityFilteringBehavior | No | OneDirection | BothDirections | None |