这是一个相当广泛的讨论问题,所以在这里'进行一些讨论。
维度表
-- Products -----
ProductId
Name
(etc.)
每个被跟踪的产品包含一行
ProductId 应该是代理键
-- Time --------
TimeId
ReportingPeriod (Q1, week 17, whatever as desired)
(etc.)
包含每一天被跟踪的一行。
一旦知道一天活动的结果,就可以将其添加到仓库中
请注意,TimeId 不必是代理键
事实表
-- Inventory -------------------------
ProductId
TimeId
一旦知道一天活动的结果,就可以将它们添加到仓库中
每个产品一行(每天),列出截至当天结束时可用的库存
但随后就变得复杂了:需要哪些数据,哪些数据可用?假设数据是一天的,可能要跟踪和记录的事实包括:
StartingInventory -- What you had at the start of the day
UnitsReceived -- Units received for storage today
UnitsSold -- Units sold (that cannot be sold again) but not yet shipped
UnitsShipped -- Units shipped (sold or otherwise)
EndingInventory -- Units in stock at end of day
它会很快变得复杂。同样,很大程度上取决于您有哪些可用信息以及您的仓库会被问到哪些问题。