Fact Relationship Type in SSAS



When the Dimension table and the Fact Table(also called as Measure Group Table) are SAME then that type of relationship is called as Fact Relationship. Lets take a small example from a very well known database to most of us i.e AdventureWorks.

Lets take a scenario like “A user wants to see the number of products available based on Color Type”. In this case “xColor” is my Attribute and that column is from DimProduct table and hence DimProduct is our Dimension table and the measure/metric is “Count” of products which you can get from DimProduct table again and hence our Measure Group table is ALSO DimProduct table. So,

Dimension Table – DimProduct and Attribute – Color

Fact Table – DimProduct and Measure – Count of Rows.

If you write query for the same then it looks like the query given below –

select Color,Count(*) as “Number of Products” from DimProduct Group By Color

The above query returns you the count of products by each color. Now lets see how it looks like in Cube Designer. Remember this is the only Relationship type that you dont need to configure. When you add the dimension to the cube and when you define measure group with the same table that is is used to create Dimension then SSAS Server automatically detects and configures. PFB the screenshot showing the Fact Relationship given between DimProduct Dimension and DimProduct Fact.

Fact Relationship in SSAS
Fact Relationship in SSAS

So, You dont need to worry of giving Fact relationship as the head ache of giving relationship will be taken by SSAS Server.

That’s it .. Happy Coding .. 🙂


Roopesh Babu V