Best Praticte for inserting fact and linking to dimensions
3 posters
Page 1 of 1
Best Praticte for inserting fact and linking to dimensions
Hi all,
is it allowed to have null values in fact table for some dimensions foreign keys ?
Exemple :
DateDimFk DimFk1 DimFk2 50 (coming from business system 1)
DateDimFk null DimFk2 50 (coming from business system 2)
or do i have to create a special dimension data row (for instance "?") to link these facts ?
Many thanks in advance.
Best Regards.
is it allowed to have null values in fact table for some dimensions foreign keys ?
Exemple :
DateDimFk DimFk1 DimFk2 50 (coming from business system 1)
DateDimFk null DimFk2 50 (coming from business system 2)
or do i have to create a special dimension data row (for instance "?") to link these facts ?
Many thanks in advance.
Best Regards.
bmoraillon- Posts : 12
Join date : 2010-06-06
Re: Best Praticte for inserting fact and linking to dimensions
Null foreign keys in fact tables is very bad practice. Always populate the key and reference a 'not applicable' row. Queries that have joins where an FK may be null will exclude those rows from the query, even if you are not filtering on a value in that dimension.
Re: Best Praticte for inserting fact and linking to dimensions
ngalemmo wrote:Null foreign keys in fact tables is very bad practice. Always populate the key and reference a 'not applicable' row. Queries that have joins where an FK may be null will exclude those rows from the query, even if you are not filtering on a value in that dimension.
Thank you very much !
bmoraillon- Posts : 12
Join date : 2010-06-06
Re: Best Praticte for inserting fact and linking to dimensions
It's common to use -1 as the default value for a dimension key value in the fact table. Add a row to each dimension table with -1 as it's surrogate key value. I would populate the columns for this "null" row with "NA", Not Applicable", "missing", etc., whatever is appropriate (Nulls in a column that is being filtered are a drag).
Jeff Smith- Posts : 471
Join date : 2009-02-03

» Dear all. I can't figured out how how to linking in my structure the promotion/deal dimensions to the fact table avoiding dupplicates line
» Linking or Merging Similar dimensions from Different Source Systems
» "Linking" two Fact tables for Cube users
» Linking two Fact tables with different grain through a hierarchy dimension
» Data Modelling -- linking Header and Detail Fact Tables.
» Linking or Merging Similar dimensions from Different Source Systems
» "Linking" two Fact tables for Cube users
» Linking two Fact tables with different grain through a hierarchy dimension
» Data Modelling -- linking Header and Detail Fact Tables.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|