dimension(day ranges)
3 posters
Page 1 of 1
dimension(day ranges)
Please I have a Fact table that records a call for each customer, there is a requirement to know how many customer picked up in the last 0- 30 days ,31-60 , 61days and above.
I was thinking to have like a stub dimension where by there will be a column for the PK and another for the range of days, but my concern is since the days from the date of call will always increase daily, then the corresponding pk will change as well and that will mean the fk in the facttable will keep changing for a row.
The other thought is to calculate the amount of customer of the date ranges outside of the warehouse using sql.
please is there a better way
I was thinking to have like a stub dimension where by there will be a column for the PK and another for the range of days, but my concern is since the days from the date of call will always increase daily, then the corresponding pk will change as well and that will mean the fk in the facttable will keep changing for a row.
The other thought is to calculate the amount of customer of the date ranges outside of the warehouse using sql.
please is there a better way
kball15- Posts : 5
Join date : 2015-11-30
Re: dimension(day ranges)
Store a relative date number in the date dimension.
You have two columns. One contains a sequence number assigned to the date chronologically from the beginning of the calendar. You use that column to maintain a second column which contains the sequence relative to 'today'. The second column is calculated daily as today's sequence value minus the other day's sequence value. The second column would contain 0 for today, negative values for future dates and positive values for past dates. You then simply group/filter on a range of these numbers. For example, values 1 through 30 would represent the last 30 days.
You can use the same technique for any calendar period. A typical data dimension would contain relative sequences for weeks, months, fiscal periods and so forth.
You have two columns. One contains a sequence number assigned to the date chronologically from the beginning of the calendar. You use that column to maintain a second column which contains the sequence relative to 'today'. The second column is calculated daily as today's sequence value minus the other day's sequence value. The second column would contain 0 for today, negative values for future dates and positive values for past dates. You then simply group/filter on a range of these numbers. For example, values 1 through 30 would represent the last 30 days.
You can use the same technique for any calendar period. A typical data dimension would contain relative sequences for weeks, months, fiscal periods and so forth.
Re: dimension(day ranges)
Thanks, will work on it, and update you
kball15- Posts : 5
Join date : 2015-11-30
Re: dimension(day ranges)
Are you using a BI tool (SSRS, BO, OBIEE, Cognos, etc.)? If so then these should all allow you to set up calculated fields that do this quite easily
If not then I would implement the logic using DB views.
IMO - anything that has a value dependent on another moving value (such as "today") is much better implemented in a BI Tool or a DB View rather than stored using persistent values in a DB
If not then I would implement the logic using DB views.
IMO - anything that has a value dependent on another moving value (such as "today") is much better implemented in a BI Tool or a DB View rather than stored using persistent values in a DB
nick_white- Posts : 364
Join date : 2014-01-06
Location : London
Re: dimension(day ranges)
I am using ssas and ssrs, I added a column to the date dimension that subtract each date column from today to get the date(I will move the column to the ssas Data source view as suggested. Thanks
kball15- Posts : 5
Join date : 2015-11-30
Re: dimension(day ranges)
Either way works. You can do a daily update or calculate on the fly by doing a self join of the dimension to find today's row.
The difference is; doing a daily update allows you to control when 'today' is. If you are doing nightly batch loads of the data warehouse, you can control what the user sees by controlling when to declare 'today'. So if you have load issues, you can delay access to today's transactions by not advancing the date until the problem is resolved.
The difference is; doing a daily update allows you to control when 'today' is. If you are doing nightly batch loads of the data warehouse, you can control what the user sees by controlling when to declare 'today'. So if you have load issues, you can delay access to today's transactions by not advancing the date until the problem is resolved.

» How to create "fill in" rows for date ranges that have gaps?
» Best way to implement date ranges in schemas (fact 1 valid "from" date1 "to" date 2)
» Replacing Aggregate dimension with Conformed base dimension at lowest level.
» How to handle a Type I or II dimension with a snowflaked customer sub dimension (kimball book page 337, 338)
» bridge table and junk dimension on customer dimension (bank/credit union)
» Best way to implement date ranges in schemas (fact 1 valid "from" date1 "to" date 2)
» Replacing Aggregate dimension with Conformed base dimension at lowest level.
» How to handle a Type I or II dimension with a snowflaked customer sub dimension (kimball book page 337, 338)
» bridge table and junk dimension on customer dimension (bank/credit union)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|