使用尺寸计算的测量

发布于 2024-08-29 20:15:23 字数 296 浏览 12 评论 0原文

我正在尝试在 SSAS 中构建一个包含维度参数的计算度量。我有两个事实:会员和会员。订单和一维:日期。会员代表我网站上的所有独特会员。订单通过代表唯一用户的事实键与成员相关。订单还包含代表订单供应商的键。订单包含日期维度的键。

事实成员 - 会员事实密钥 - 会员ID 事实顺序 - 事实订单键 - 订单编号 - 事实成员密钥 - DimVendorKey - DimDateKey 暗淡日期 - DimDateKey - FYYear

我试图构建的计算指标是会员从其订购的唯一供应商的数量。当然,计算值必须根据日期维度而变化。

I am trying to build a calculated measure in SSAS that incorporates a dimension parameter. I have two facts: Members & Orders and one Dimension: Date. Members represents all the unique members on my site. Orders are related to members by a fact key representing a unique user. Orders also contains a key representing the vendor for an order. Orders contains a key to the date dimension.

FactMember
- MemberFactKey
- MemberId
FactOrder
- FactOrderKey
- OrderId
- FactMemberKey
- DimVendorKey
- DimDateKey
DimDate
- DimDateKey
- FYYear

The calculated measure I am trying to build is the number of unique vendors a member has ordered from. The value of the calculation must of course change based on the date dimension.

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

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

发布评论

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

评论(2

北音执念 2024-09-05 20:15:23

这里不应该使用 DISTINCTCOUNT 函数吗?然后可以在此查询和其他地方使用创建不同的供应商计数。

WITH MEMBER [Test]
AS
DISTINCTCOUNT([Vendor].[Vendor].[Vendor])

我会提前说,这可能很慢(取决于数据量/分布),因此,如果此查询将成为设计的流行/重要部分,则可能值得考虑重组。

Wouldn't the DISTINCTCOUNT function be the one to use here? Creating a distinct count of Vendors could then be used in this query and elsewhere.

WITH MEMBER [Test]
AS
DISTINCTCOUNT([Vendor].[Vendor].[Vendor])

I will say in advance that this may well be slow (Depending on data volume/distribution), so if this query will be a popular/big part of the design it may be worth considering a restructure.

逆夏时光 2024-09-05 20:15:23

我很困惑,将“会员”和“订单”这两个维度分开,然后从 FACT 表中引用它们(例如 Fact.Sales)会更有意义。如果您在某种 member_key 上键入“成员”维度,则甚至无需构建计算成员。

I am confused, it would make more sense to make Members and Orders both separate dimensions and then reference them from a FACT table, say Fact.Sales. This would eliminate the need to even build a calculated member if you keyed your Members dimension on some sort of member_key.

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