使用尺寸计算的测量
我正在尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里不应该使用 DISTINCTCOUNT 函数吗?然后可以在此查询和其他地方使用创建不同的供应商计数。
我会提前说,这可能很慢(取决于数据量/分布),因此,如果此查询将成为设计的流行/重要部分,则可能值得考虑重组。
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.
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.
我很困惑,将“会员”和“订单”这两个维度分开,然后从 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.