简体   繁体   English

数据仓库中的事务生命周期跟踪

[英]Transaction lifecycle tracking in data warehouse

How do you store facts within which data is related? 您如何存储与数据相关的事实? And how do you configure the measure? 以及如何配置度量? For example, I have a data warehouse that tracks the lifecycle of an order, which changes states - ordered, to shipped, to refunded. 例如,我有一个数据仓库,该数据仓库跟踪订单的生命周期,从而将状态(已订购,已发货,已退款)更改为退款。 And for a state like 'refunded', it is not always there. 对于“退款”这样的州,它并不总是存在的。 So in my model, I am employing the transaction store model, so every time the order changes state, it is another row in the fact table. 因此,在我的模型中,我正在使用事务存储模型,因此每次订单更改状态时,它都是事实表中的另一行。 So, for an order that was placed in april, and refunded in may, there will be two rows - one with a state of 'ordered' and another with a state of 'refunded'. 因此,对于4月份下​​达并可能在5月内退款的订单,将有两行-一列的状态为“已订购”,另一列的状态为“已退款”。 So if the user wanted to see all the orders placed/ordered in april, and wanted to see how many of 'those' orders got refunded, how would he see that? 因此,如果用户想要查看四月份下的所有订单,并想查看有多少“那些”订单已退款,他将如何看待? Is this a MDX query that will be run at runtime? 这是将在运行时运行的MDX查询吗? Is this is a calculated measure I can store in the cube? 这是我可以存储在多维数据集中的计算得出的度量值吗? How would I do that? 我该怎么做? My thought process is that it should be a fact that the user can use in a pivottable, but I'm not sure..... 我的想法是,用户可以在数据透视表中使用它是一个事实,但是我不确定.....

One way to model this would be to create a factless fact table to model events. 对此建模的一种方法是创建一个事实表来对事件进行建模。 Your ORDERS fact table models the transaction amount, customer information etc, while the factless fact table (perhaps called ORDER_STATUS) models any events that occur in relation to a specific order. 您的ORDERS事实表对交易金额,客户信息等进行建模,而事实表(可能称为ORDER_STATUS)则对与特定订单有关的任何事件进行建模。

With this model, it's easy to count or add all transactions based on their order status by checking for existence of records in the factless fact table. 使用此模型,可以通过检查事实表中是否存在记录来轻松地根据订单状态对所有交易进行计数或添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM