SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Attribute can change over time but which dim should it go into?


Attribute can change over time but which dim should it go into?

Author
Message
aaa121
aaa121
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5130 Visits: 795
Ok so I have two stages within a product lifecycle:

1. Application
2. Contract

In the application phase I have a metric, let's call it CoveredAmount which can change throughout the Application phase. Once the Application is agreed and it moves to a Contract this amount doesn't change. In the source database (which has been modelled in 3rd NF from the OLTP system - don't ask!) this metric is stored against both the Application and the Contract equivalent tables.

Until the Application moves to a Contract stage there a ContractID (Business key) does not exist. The business also do not need to sum these amounts so I am not treating it as a fact.

Currently I plan to track CoveredAmount within the Application dimension as a Type 2 SCD but rename it to ApplicationCoveredAmount so the business users can look at changes over time during this phase. I then plan to store the final CoveredAmount in the Contract dimension.

I was handed a draft dim model design put together by a prev employee - who wasn't fully up to speed on the source system and they had CoveredAmount as a Type 2 on the Contract dimension only. I don't believe this is a accurate representation of the business process nor could you track any changes as there would be no business key to join it up to the contract data.

Does this make sense to everyone? I want to ensure I am not missing anything obvious as it seems to easy....any feedback or questions??

Thanks for reading.
xsevensinzx
xsevensinzx
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20205 Visits: 5444
It makes sense if you're trying to give the users the ability to pull in attributes on the contract as well attributes on the application. In meaning, you are capturing the journey from application to contract and you want to ensure when you join the contract records, you can also join the application details with those records. It's just a matter of how you are handling the capture of this journey in the fact table.

I would imagine you start populating the fact with that history as soon as the application comes in. This becomes a record without a ContractID. Then when that user does sign a contract, how do you handle the history from that point on? Does it become a new record where there is a ContractID with the ApplicationID? Do you update the previous application record with the ContractID? Or do you just delete the prior records and leave one record per journey with the ContractID and ApplicationID where the Type 2 Dimensions are the only details on that history? Either way, sounds like the history has to be recorded, just a matter of where.

I think for the most part, people track that history in the fact. In meaning, you are capturing every event, state, log that user makes on their journey in the actual fact table. That way you can see a clear history of steps from 0 to N of that user. You may have a date field, customerID field, applicationID field, contractID field, and other attributes with the metrics combined in that record. Where the application dimension may have details on the app and likewise of details of the contract it's respective dimension. Then Type 2 comes into play when details of that application change on the attribute side, not the metric side. Like a name change, martial status change, contract state change, etc.

While this may result in a lot of logs, that's what most are shooting for so they can then roll that history up any way they see fit to meet the needs of the business and how the business may change down the road. For example, going from a detailed history in the data warehouse to a summarized history in the data mart layer where it's easier to analyze and query into the visualization layer like SSRS, Tableau, PowerBI, etc.
RonKyle
RonKyle
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25988 Visits: 4346
Additional information would be helpful. First, what is the granularity of the fact table(s)? Is it every change in the application? Part of your discussion makes me think of an accumulating snapshot fact table. In this case, you are tracking the progress of an application from start to finish. But as finish in this case is "contract," which seems to have it's own characteristics not shared by application (I think), I'm not sure.

As for the 2SCD, that is used for preserving history when items shift within the hierarchy. For example, if a store is assigned to a different region, without a 2SCD dimension, all that store's history in the original region would be transferred to the new one. This doesn't seem that case.



aaa121
aaa121
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5130 Visits: 795
Ok let me try and answer some of your questions:

1. Amongst other objects there is a Dim application and contract as well as a Fact application (granularity is 1 record per application) and contract (1 record per contract). Fact Application contains the ApplicationID while Fact Contract contains both the ApplicationID and ContractID.
2. The fact application will start being populated as soon as the application comes in
3. When a contract is signed it will be tracked in the fact contract table. So a fact table to represent each business process at the lowest grain available.
4. As the various things change on on the app or the contract such as the status then this will be tracked in the dimension as a type 2 and also a new record added to the fact table
5. There is a bridge table to marry up the application & contracts to the customer dimension to resolve the M2M relationship
6. You are absolutely correct in stating an accumulating snapshot table. That is certainly the plan along with the existing fact tables mentioned above. An application and status moves through it's own stages during the process independent of each other and can overlap and iterate back to previous statuses etc.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search