SSAS Dimension Usage (Measure Group and Cube Dimensions) Relationship Types
Hi All,
I was working on to extract Measure Group and Cube Dimensions Relationship Types metadata and got confused about Many-to-Many Relationship type implementation.
My Question is on Many-to-Many Dimensions: Can we have more than one Intermediate Regular Dimensions linked to Intermediate Fact Table and Fact Table?
1st will mention available Relationship Types and their description:
- No Relationship: The dimension and measure group are not related.
![]()
- Regular: The dimension table key column is joined directly to the fact table. A regular dimension relationship between a cube dimension and a measure group exists when the key column for the dimension is joined directly to the
fact table. This direct relationship is based on a primary key–foreign key relationship in the underlying relational database, but might also be based on a logical relationship that is defined in the data source view. A regular dimension relationship represents
the relationship between dimension tables and a fact table in a traditional star schema design.
![]()
- Fact/Degenerate: The dimension table is the fact table.Fact dimensions, frequently referred to as degenerate dimensions, are standard dimensions that are constructed from attribute columns in fact tables instead of from attribute columns in dimension tables. Useful dimensional data is sometimes stored in
a fact table to reduce duplication.
![]()
- Referenced: The dimension table is joined to an intermediate Regular dimension table, which is turn, is joined to the fact table. A reference dimension relationship between a cube dimension and a measure group
exists when the key column for the dimension is joined indirectly to the fact table through a key in another dimension table, as shown in the following illustration.
A reference dimension relationship represents the relationship between dimension tables and a fact table in a snowflake schema design. When dimension tables are connected in a snowflake schema, you can define a single dimension using columns from multiple
tables, or you can define separate dimensions based on the separate dimension tables and then define a link between them using the reference dimension relationship setting. The following figure shows one fact table named InternetSales,
and two dimension tables called Customer and Geography, in a snowflake schema.
![]()
You can create a dimension with the Customer table as the dimension main table and the Geography table included as a related table. A regular relationship is then defined between the dimension and the InternetSales measure group.
Alternatively, you can create two dimensions related to the InternetSales measure group: a dimension based on the Customer table, and a dimension based on the Geography table. You can then relate the Geography dimension to the InternetSales
measure group using a reference dimension relationship using the Customer dimension. In this case, when the facts in the InternetSales measure group are dimensioned by the Geography dimension, the facts are dimensioned by customer and by geography. If the
cube contained a second measure group named Reseller Sales, you would be unable to dimension the facts in the Reseller Sales measure group by Geography because no relationship would exist between Reseller Sales and Geography.
There is no limit to the number of reference dimensions that can be chained together, as shown in the following illustration.
![]()
- Many-to-Many: The dimension table is joined to an intermediate fact table. The intermediate fact table is joined, in turn, to an intermediate regular dimension table to which the fact table is joined.
Example: I have to create a many to many relationship between Fact Table A and Dimension Table D. Let’s assume I have an intermediate Fact Table called C and Intermediate Regular Dimension Table B.
Intermediate Fact Table C is already having a regular relationship to Dimension D and Intermediate Dimension B. Also Fact Table A already has an regular relationship to intermediate Dimension table B. So Now Fact A and Dimension D have Many-to-Manu relationship.
In most dimensions, each fact joins to one and only one dimension member, and a single dimension member can be associated with multiple facts. In relational database terminology, this is referred to as a one-to-many relationship. However, it is frequently
useful to join a single fact to multiple dimension members. For example, a bank customer might have multiple accounts (checking, saving, credit card, and investment accounts), and an account can also have joint or multiple owners. The Customer dimension constructed
from such relationships would then have multiple members that relate to a single account transaction.
![]()
Note
To support a many-to-many dimension relationship, the data source view must have established a foreign key relationship between all the tables involved, as shown in the previous diagram. Otherwise, you will be unable to select the correct intermediate measure
group when establishing the relationship in the Dimension Usage tab of Dimension Designer.
- Data Mining: The Target dimension is based on a mining model built from the source dimension. The source dimension must also be included in the cube.
![]()
https://docs.microsoft.com/en-us/sql/analysis-services/multidimensional-models-olap-logical-cube-objects/dimension-relationships?view=sql-server-2017