My fact table consists of complaints with typical dimensions of who, what and when. We have a target that the complaint should be responded to within a certain time period.
I'm not sure on how I best to model whether the complaint had a response within that time period.
I can store both the target value and the result in the fact table as integers with the result as a measure. Or I could use a dimension which has values of yes/no instead of representing this as a measure, I could then use a calculated measure in my cube. Or I could use a combination of both.
Are there any pros, cons and gotchas modelling the facts in the ways described above?
I anticipate that this fact table will be used to get the total number of complaints, the number of complaints responded to in time, the percentage responded in time and also identify individual complaints which were not responded to in time.
Best Answer
Here is a flexible way to store it that should support changes in requirements in the future.
registration_date - closing_date
.For the result, I wouldn't store it as a flag (yes/no) but as a number. If you call the column
on_time
and put a 1 for each complaint that meets the target, you can easily SUM on that column to have the total of on_time complaints over a period.I see three ways of getting the result :
fact_complaint.elapsed_time
is lower than or equal todim_complaint_type.target
or not. It might be dangerous if different persons use different formulas. If you have a tool with a metadata layer (e.g. OBIEE, SAP BO, ...), you can define that result measure once for all.