我正在从事务表重构Factless Fact表。有明显的共享目标,如组织,状态,服务,ServiceAction,发送日期等。但是,我正在尝试解决2个问题:
在“交易”表上,有“电话”,“电子邮件”,“chkbxRequestReceipt”等值的“自由格式输入”字段。它们都直接与TransactionKey相关。如果我将这些字段从事实表中拉出到它们自己的暗淡中,它会创建一个1-1暗淡的事实关系,这似乎是不正确的。
ServiceAction dim在事实表上是1个字段,但随后分为3个不同的昏暗表。这样做是因为服务几乎没有共同的领域。每个ServiceAction都有1个Transaction。因此,3个服务表中的行总和=“事务表”的总行数。
有人能就这种模型的最佳方式提出建议吗?
答案 0 :(得分:1)
您可以将电话,电子邮件,chkbxRequestReceipt视为Degenerate Dimension(或多个退化维度)。简并维度是没有维度表的维度。当事实表具有事务级别粒度时,您具有退化维度。
关于ServiceAction
的三个表格。我的建议是将它们放在同一个维度表中,但我知道你会有一个包含很多NULL的表。如果您只是手动编写报表,则三个表不是问题,但如果您使用利用维模型自动生成SQL代码的工具,那么您可能需要一个维度表。
您甚至可以认为在事实表上有三个不同的维度共享相同的列,这将起作用,但如果业务用户可以创建自己的报告,则可能会有点混乱。无论如何,在这种情况下,您还需要创建第四维AllSerivceAction
,以防您需要创建要显示所有来电的报告以及有关ServiceAction
的信息
答案 1 :(得分:0)
1) Not every data item necessarily belongs in a dimensional model. Dimensions are supposed to be the things you would analyse your measures by. Are your users going to look at any of your measures by phone number, email address, or whether a receipt was requested? If not, these things quite likely don't belong in your dimensional model. They might belong in a normalized warehouse layer or a reporting database, if you also have those.
If someone insists that these must be available within the dimensional model (and their reasoning is sound - say, they do analysis using more obvious dimensions first, and occasionally they then need to look at one of these data items to take action on something odd they've found):
2) It's honestly difficult to judge whether this is correct from the information given. Without knowing more about what a Service is, what a ServiceAction is, what fields exist in your ServiceAction dimension, etc. I wouldn't want to guess at a suitable design for this. I'll happily revisit this if more information is added.