Type 2 Dimension with accumulating snapshot with time stamp
3 posters
Page 1 of 1
Type 2 Dimension with accumulating snapshot with time stamp
I have a question on how to add records into accumulating snapshot. I have a Type 2 Dimension and a Accumulating snapshot table with time stamp. When a new row is added to the Dimension should a row be added to the fact table, even if there is no change to any attribute in the fact table. I am assuming i don't revisit the fact table, but then the most current dimension record won't match to anything in the fact table. Thank you.
mcpujabi- Posts : 2
Join date : 2013-11-27
Re: Type 2 Dimension with accumulating snapshot with time stamp
Hi,
i use a fact snapshot too.
Take this dim_table like example:
dim(sk,atribute1, atribute2,...,flag_is_current,date_begining,date_end)
when a new row is added in dim_table a new sk is inserted and the last sk where the flag_is_current is "Y" ou "Yes" changes to "N" or "No" and the new SK had flag_is_current change to "Yes" or "Y". When fact look to this table will pick the SK where the flag is "Y" or "Yes".
Hope this helps
i use a fact snapshot too.
Take this dim_table like example:
dim(sk,atribute1, atribute2,...,flag_is_current,date_begining,date_end)
when a new row is added in dim_table a new sk is inserted and the last sk where the flag_is_current is "Y" ou "Yes" changes to "N" or "No" and the new SK had flag_is_current change to "Yes" or "Y". When fact look to this table will pick the SK where the flag is "Y" or "Yes".
Hope this helps
RafaelR- Posts : 10
Join date : 2013-11-20
Re: Type 2 Dimension with accumulating snapshot with time stamp
An example might help.
Day 1: Source system
Datawarehouse:
Day 2: Source system
Datawarehouse:
If i now want to get the latest record in SQL:
SELECT * FROM dimCustomer JOIN FactCustomer WHERE CurrentFlag = Y
This will give me no records as there is no Fact record. Should i put a fact record on Day 2 as well?
Day 1: Source system
CustID | CustomerName | Amount |
15416 | John Smith | 500 |
DimCustomerKey | CustID | CustomerName | CurrentFlag |
1 | 15416 | John Smith | Y |
CustomerKey | Amount |
1 | 500 |
CustID | CustomerName | Amount |
15416 | John R Smith | 500 |
DimCustomerKey | CustID | CustomerName | CurrentFlag |
1 | 15416 | John Smith | N |
2 | 15416 | John R Smith | Y |
CustomerKey | Amount |
1 | 500 |
SELECT * FROM dimCustomer JOIN FactCustomer WHERE CurrentFlag = Y
This will give me no records as there is no Fact record. Should i put a fact record on Day 2 as well?
mcpujabi- Posts : 2
Join date : 2013-11-27
Re: Type 2 Dimension with accumulating snapshot with time stamp
No. The fact record points to the dimension that was in effect when the event occurred. If you want the current row there are multiple strategies to do this including, adding an additional SK to the fact to join, performing a self join on the dimension to get the current row, or even adding another type 1 dimension. We need a sticky post to capture the Kimball Forum Tips and Tricks.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
Similar topics
» Time in fact or dimension? Accumulating snapshot
» Accumulating Snapshot Fact OR Type 3 Dimension?
» Point of time information from accumulating snapshot.
» Subscription as an Accumulating Snapshot Fact or a Dimension?
» Accumulating Snapshot Fact with Dimension at Same Grain
» Accumulating Snapshot Fact OR Type 3 Dimension?
» Point of time information from accumulating snapshot.
» Subscription as an Accumulating Snapshot Fact or a Dimension?
» Accumulating Snapshot Fact with Dimension at Same Grain
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum