Time Dimension Vs FACT
4 posters
Page 1 of 1
Time Dimension Vs FACT
I have a Business Requirement to indicate student scores which are were recorded in the last year based on the current date.
I have a FACT TABLE which records the student scores e.g. A Student got TOFEL in 2011-Jan and got another one in Jan-2014.
I would like to indicate the Jan-2014 record as the currently valid one since its within the 1 year validity period.
Would it be a good practise to add a column in this fact table called ONE_YR_VALIDITY_IND and have 0's and 1's
or
Would it make sense to add a new column in the time dimension table called ONE_YR_VALID_IND and flag all such time keys to Y
and then simply join the time key on time dimension to the time key on the fact table i.e. the date on which the test was taken by the student.
Thanks guys!
I have a FACT TABLE which records the student scores e.g. A Student got TOFEL in 2011-Jan and got another one in Jan-2014.
I would like to indicate the Jan-2014 record as the currently valid one since its within the 1 year validity period.
Would it be a good practise to add a column in this fact table called ONE_YR_VALIDITY_IND and have 0's and 1's
or
Would it make sense to add a new column in the time dimension table called ONE_YR_VALID_IND and flag all such time keys to Y
and then simply join the time key on time dimension to the time key on the fact table i.e. the date on which the test was taken by the student.
Thanks guys!
hunain- Posts : 19
Join date : 2013-09-15
Re: Time Dimension Vs FACT
No need to create a field in fact table. It will will be expensive to update fact table. You can join with time dimension and filter on year field.
vp2014- Posts : 1
Join date : 2014-01-28
Re: Time Dimension Vs FACT
If it has a one year validity, I would add a another relationship to the date dimension to indicate end of validity. This avoids any update logic.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
Re: Time Dimension Vs FACT
I would suggest that you don't go for any solution that hardcodes the flag value as you would then need to maintain the values every day (to check which were no longer valid and update them.
The solution of adding an additional Date Dim relationship obviously works but if you do want a flag/indicator then use a calculated column (on your table, in a view or in your BI tool if you are using one) e.g. current_flg = case when (sysdate - score_date) < 365 then 'Y' else 'N'
The solution of adding an additional Date Dim relationship obviously works but if you do want a flag/indicator then use a calculated column (on your table, in a view or in your BI tool if you are using one) e.g. current_flg = case when (sysdate - score_date) < 365 then 'Y' else 'N'
nick_white- Posts : 364
Join date : 2014-01-06
Location : London
Re: Time Dimension Vs FACT
Nick, Thank You Indeed! Thats what I thought, updating the dimension table everyday just to update this indicator does not make much sense. I will go with your option have a calculated or derived column on the time dimension table. Thanks!
hunain- Posts : 19
Join date : 2013-09-15
Similar topics
» Time in fact or dimension? Accumulating snapshot
» Time elapsed between dimension attribute and fact
» Model available time per day in timesheet data warehouse: fact or dimension or neither?
» Transaction Hour in Fact table or Separate Time Dimension?
» Combined Date Time dimension vs. Separate Day and Time dimensions and timezones
» Time elapsed between dimension attribute and fact
» Model available time per day in timesheet data warehouse: fact or dimension or neither?
» Transaction Hour in Fact table or Separate Time Dimension?
» Combined Date Time dimension vs. Separate Day and Time dimensions and timezones
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum