简体   繁体   English

数据仓库/BI 建模:事实还是维度?

[英]Data Warehouse / BI modeling: Fact or Dimension?

I am building a data warehouse using the famous facts/dimensions star scheme.我正在使用著名的事实/维度星型方案构建数据仓库。 Currently implementing employee performance data.目前正在实施员工绩效数据。

I have two sources:我有两个来源:

  1. The ticket system where I get我得到的票务系统
fact: spent time, billed amount dimension: Employee, Date, Customer, type-of-time (billed, not-billed, internal, service, driving-time ...)
  1. The time clocking system, where i get计时系统,我在哪里
fact: worked hours dimension: Employee, Date

What would be the "correct" approach:什么是“正确”的方法:

A. Add the Worked hours as separate fact? A.将工作时间添加为单独的事实?

B. Just have a "time spent" fact and add the worked hours as a dimension to the type-of-time dimension? B.只是有一个“花费时间”事实并将工作时间作为维度添加到时间类型维度?

The goal is to create a dashboard with info such as billed time vs worked time, amount of not-billed time etc.目标是创建一个仪表板,其中包含计费时间与工作时间、未计费时间等信息。

As suggested by the OP, here my comment as answer:正如 OP 所建议的,这里是我的评论作为答案:

This depends on your structure / aggregation level of the facts.这取决于您的事实结构/聚合级别。 Example: Employee A works 9.5 hours on March 2nd 2020. He Works 4 hours for Customer X and 5 hours for Customer Y. Additionally, he has a 30 minute break (whis is not billed).示例:员工 A 在 2020 年 3 月 2 日工作 9.5 小时。他为客户 X 工作 4 小时,为客户 Y 工作 5 小时。此外,他有 30 分钟的休息时间(不计费)。 Your ticketing system most certainly contains 2 rows - one per customer.您的票务系统肯定包含 2 行 - 每个客户一行。 The Clocking System has only one aggregated row, since it does not distinguish between the customers.时钟系统只有一个聚合行,因为它不区分客户。 Therefore in this case I would suggest to create a separate fact table for the worked hours.因此,在这种情况下,我建议为工作时间创建一个单独的事实表。

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

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