I have a question about brige tables in star schemas. Most of the dicussion I have seen about(Kimball centric) bridge tables has weighting factor included into the bridge tables(which is usually set to inverse of the number of member of the set). These weighting factors are used to adjust sum queries so that the facts are not n(double triple etc) counted/summed in queries.
i.e.
select
d.field,sum(f.fact1 * b.wt)
from
dimension d,
fact f,
bridgetable b
where
f.dim_bridge_fk = b.sk and
b.dim_fk = d.dim_sk
Now my question is... it seems that if in your query you constrain the dim table on a field it will mess up your sums
i.e.
select
d.field,sum(f.fact1 * b.wt)
from
dimension d,
fact f,
bridgetable b
where
f.dim_bridge_fk = b.sk and
b.dim_fk = d.dim_sk
and d.field1 = 'somevalue'
In this case it is possible that the weighting is no longer accuarate b/c I have potentially limited the number of dim_records that make up a set in the bridge table. Since the weight is static and usually equal to the inverse of number of members of the set , I suspose you can't contrain the dimension table and get accurate sums..
Is there some way to calulated this weighting factor dymically so that you can get accurate sums and counts when you query constrains on the dim_table?
Thanks
Scott
i.e.
select
d.field,sum(f.fact1 * b.wt)
from
dimension d,
fact f,
bridgetable b
where
f.dim_bridge_fk = b.sk and
b.dim_fk = d.dim_sk
Now my question is... it seems that if in your query you constrain the dim table on a field it will mess up your sums
i.e.
select
d.field,sum(f.fact1 * b.wt)
from
dimension d,
fact f,
bridgetable b
where
f.dim_bridge_fk = b.sk and
b.dim_fk = d.dim_sk
and d.field1 = 'somevalue'
In this case it is possible that the weighting is no longer accuarate b/c I have potentially limited the number of dim_records that make up a set in the bridge table. Since the weight is static and usually equal to the inverse of number of members of the set , I suspose you can't contrain the dimension table and get accurate sums..
Is there some way to calulated this weighting factor dymically so that you can get accurate sums and counts when you query constrains on the dim_table?
Thanks
Scott