Pentaho:将日期转换为可向下钻取的多维数据集维度的最佳方法?

发布于 2024-09-13 20:24:30 字数 234 浏览 7 评论 0原文

我的数据仓库表仅包含一个 date SQL 列,但我希望能够使用通常的年/季度/月/日级别进行向下钻取。

我可以使用 Pentaho Kettle 手动创建新列,然后在 Pentaho Schema Workbench 中逐一创建级别。

但这是一项常见的任务(我猜每个创建与销售相关的多维数据集的人都必须这样做),所以我确信 Pentaho 开发了一些东西可以在几秒钟内完成它。推荐的做法是什么?

My datawarehouse table just contains a single date SQL column, but I want to be able to drill down using the usual year/quarter/month/day levels.

I could manually create new column using Pentaho Kettle, and then create the levels one-by-one in Pentaho Schema Workbench.

But this is such a common task (I guess everybody creating sales-related cubes has to do it), so I am sure Pentaho developed something to do it in seconds. What is the recommended way of doing it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2024-09-20 20:24:30

我不知道有什么内置方法可以做到这一点。

这是我几年前学到的一个好技巧:
有一个名为“时间”的表,每天/小时一行,具体取决于您的分辨率首选项。

对于日期,每个此类行将包含:

Date (date) - 2010-09-28
Day (int) - 28
Month (int) - 9
Year (int) - 2010

并且您可以添加任意多个字段:
季度、周中的天、从年初算起的天、一年中的周等。

此表预先填充了日期。当您的查询需要类似多维数据集的聚合时,您可以将时间表与数据仓库表连接起来,以创建您喜欢的任何聚合。

这种方法的一个很好的优点是,通过在查询中使用外连接,您还可以将空日期添加到报表中,而不仅仅是聚合包含值的日期。如果您深入到非常稀疏的维度,这是一个重要的功能。

I don't know a built in way to do this.

Here's a nice trick I've learned a few years back:
Have a table called Time with one row per day/hour, depending on your resolution preferences.

For dates, each such row will contain:

Date (date) - 2010-09-28
Day (int) - 28
Month (int) - 9
Year (int) - 2010

And you can add as many fields as you like:
Quarter, Day in week, Day from year start, Week in year, etc.

This table is pre-populated with dates. When your query requires cube like aggregations, you can join the Time table with the data-warehouse table, to create any aggregation you like.

A nice advantage of this approach is that by using outer joins in the query, you can also add empty dates to the report and not only aggregate on dates which contain values. This is an important feature if you drill down to very sparse dimensions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文