将订单项目从每小时到每天进行分组

发布于 2025-01-27 08:44:33 字数 391 浏览 2 评论 0原文

我想将这些订单项目的价格总结在一起,以便为合同的每个订单。

我想减少每小时的粒度,从而减少我们传递给事实表,然后再将SSAS多数的行计数。

IE合同A可以有许多订购,请考虑可以有许多订单项目的订单线1。 我不得不筛选订单项,但它们只是顺序ID号。

问题在于,我必须从每小时到每天的粒度,但仍然可以使用户可以访问订单项级别

”

I would like to SUM the price of these Order Items together for each Order for a Contract.

I want to reduce my granularity from hourly to daily and so reduce the row count that we pass to the fact table and then the SSAS cube.

i.e. Contract A which can have many Orderlines, consider Orderline 1 which can have many Order Items.
I have had to screen the Order Items, but they are just sequential id numbers.

The problem is that I have to roll this up to a daily granularity from hourly, but still be able to give users on the cube access to the Order Item level

enter image description here

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

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

发布评论

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

评论(1

猥琐帝 2025-02-03 08:44:33

您可以将sum用作窗口函数。这将有效地将相同的总和写入每个订单项目的多行;就像价格一样。

例如

SELECT ......
, SUM(price) OVER (PARTITION BY order_item)
....
FROM ....
GROUP BY ....

you can use SUM as a window function. this will effectively write the same sum to multiple rows for each order-item; just like the price.

for example

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