When a fact table is at a higher granularity to the date dimension (e.g. monthly) how should this be represented as a relationship in the data source view?
With a date dimension containing columns DateKey
and MonthDateKey
and fact table containing MonthDateKey
should the relationship be:
Fact.MonthDateKey -> Date.DateKey
or Fact.MonthDateKey -> Date.MonthDateKey
What are the implications if this is set incorrectly in the data source view?
Best Answer
This relation is not necessarily expressed in the data source view, but in the dimension usage tab, but you can define it in the dsv if you want.
The implications of setting it incorrectly in the DSV are that the dimension usage tab will propose the wrong default and you have to change it manually, but whatever you put in the dimension usage tab on your measure group is what is actually defining the relation.
Without knowing your exact data model I would think your relation has to be
Fact.MonthDateKey -> Date.MonthDateKey
in your case.There is an example of how this is done in the AdventureWorks Analysis services project where the date dimension is linked to the Sales Target measure group on
Calendar Quarter
:You basically just pick another
Granularity Attribute
from your dimension and link it to the correct column in your fact table like this:The dsv relation for this setup looks like this (which would be monthdatekey in your scenario)
The caveat is displayed as a warning when you don't select the key attribute as your granularity attribute:
Which is basically saying you need to define attribute relationships.
This is also explained in more detail in this walkthrough Defining Dimension Granularity within a Measure Group