MDX-- 不同计数
我正在关注这篇文章:
http://msdn .microsoft.com/en-us/library/aa902637%28v=sql.80%29.aspx
我对不同计数的查询如下所示:
Count(CrossJoin({[Measures].[Submission Count]}, [Submission].[PK Submission].Members), ExcludeEmpty)
它始终返回 1超出了应有的范围(例如,它返回 27 而不是 26)。
在同一篇文章中,有这个查询(应该可以解决这个问题):
Count(CrossJoin( {[Sales]},
Descendants([Customers].CurrentMember, [Customer Names])),
ExcludeEmpty)
但我无法让它工作。我已经尝试过这两个,但第二个总是返回 1 或 0,而第一个不起作用(错误:我必须显式定义级别):
Count(CrossJoin( {[Measures].[Submission Count]},
Descendants([Submission].CurrentMember, [Submission].[PK Submission])),
ExcludeEmpty)
Count(CrossJoin( {[Measures].[Submission Count]},
Descendants([Submission].[PK Submission].CurrentMember, [Submission].[PK Submission])),
ExcludeEmpty)
知道我做错了什么吗?
谢谢!
I was following this article:
http://msdn.microsoft.com/en-us/library/aa902637%28v=sql.80%29.aspx
and my query for distinct count looks like this:
Count(CrossJoin({[Measures].[Submission Count]}, [Submission].[PK Submission].Members), ExcludeEmpty)
it returns always 1 more than it should (for example it returns 27 instead of 26).
In the same article there is this query (which is suppose to solve this problem):
Count(CrossJoin( {[Sales]},
Descendants([Customers].CurrentMember, [Customer Names])),
ExcludeEmpty)
But I can't get it to work. I've tried these two but second one always returns 1 or 0 while the first one doesn't work (error: I have to explicitly define a level):
Count(CrossJoin( {[Measures].[Submission Count]},
Descendants([Submission].CurrentMember, [Submission].[PK Submission])),
ExcludeEmpty)
Count(CrossJoin( {[Measures].[Submission Count]},
Descendants([Submission].[PK Submission].CurrentMember, [Submission].[PK Submission])),
ExcludeEmpty)
Any idea what am I doing wrong?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一个查询返回“比应有的多 1”的原因是因为
[Submission].[PK Submission].Members
元组集还包含 All 成员。如果您引用
[PK Submission]
级别而不是[PK Submission]
层次结构的所有成员,则它不包括 All 成员。因此,以下返回您所期望的内容:
The reason the first query returns "1 more than it should" is because the
[Submission].[PK Submission].Members
tuple set also includes the All member.If you refer to the
[PK Submission]
level instead of all the members of the[PK Submission]
hierarchy, it doesn't include the All member.So, the following returns what you're expecting: