MDX 中的汇总:计算成员覆盖实际度量

发布于 2024-12-10 23:04:42 字数 853 浏览 0 评论 0原文

[measures].[Alert Count] 是一个真实的度量(基于事实表中的列)。

CREATE  MEMBER CURRENTCUBE.[Measures].[test6] as [measures].[Alert Count];  
([Store].[Store].[Store].members*[Calendar].[Date].[Date].members ,[measures].[test6]) = 2;

由于最后一个范围分配将 test6 的度量覆盖为 2,因此我希望以下内容为 test 的每个单元格返回 4,因为我们用 2 个日期进行切片,并且每天都有一个 test6 作为 2,然后汇总得到 2+2= 4.但实际结果并非如此:test6 始终等于[alert count]。

select {[Measures].[test6],[measures].[Alert Count]} on 0,    
[STORE].[STORE].[STORE].members on 1    
from [test]    
where {[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}

预期工作如下:test6 始终为 2。

select  {[Measures].[test6],[measures].[Alert Count]} on 0,
[STORE].[STORE].[STORE].members on 1
from [test]
where {[CALENDAR].[Date].&[2011-05-21T00:00:00]}

[measures].[Alert Count] is a real measure (based on a column in the fact table).

CREATE  MEMBER CURRENTCUBE.[Measures].[test6] as [measures].[Alert Count];  
([Store].[Store].[Store].members*[Calendar].[Date].[Date].members ,[measures].[test6]) = 2;

Since the last scope assignment overwrite the measure of test6 to 2, so I expect the following to return 4 for every cell of test because we sliced with 2 dates, and each day has a test6 as 2, then rollup to get 2+2=4. But the actual result is not: test6 is always equal to [alert count].

select {[Measures].[test6],[measures].[Alert Count]} on 0,    
[STORE].[STORE].[STORE].members on 1    
from [test]    
where {[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}

The following works expected: test6 is always 2.

select  {[Measures].[test6],[measures].[Alert Count]} on 0,
[STORE].[STORE].[STORE].members on 1
from [test]
where {[CALENDAR].[Date].&[2011-05-21T00:00:00]}

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

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

发布评论

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

评论(1

无法言说的痛 2024-12-17 23:04:42

如果添加新成员怎么办?

With Member [Measures].[test7] As Sum({[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}, [Measures].[test6])
select {[Measures].[test6], [Measures].[test7],[measures].[Alert Count]} on 0,    
[STORE].[STORE].[STORE].members on 1    
from [test]    
where {[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}

有什么用吗?

What if you add a new member?

With Member [Measures].[test7] As Sum({[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}, [Measures].[test6])
select {[Measures].[test6], [Measures].[test7],[measures].[Alert Count]} on 0,    
[STORE].[STORE].[STORE].members on 1    
from [test]    
where {[CALENDAR].[Date].&[2011-05-21T00:00:00],[CALENDAR].[Date].&[2011-06-12T00:00:00]}

is it useful?

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