MDX错误:在子多维数据集中引用计算的度量(使用成员)返回错误

时间:2013-12-26 10:32:05

标签: ssas mdx

我对MDX很新。能否请你帮我解决这个问题。感谢您的帮助。

我在下面的MDX查询执行完全正常。

with member [measures].[perc] as
([Dim Customer].[Customer ID].currentmember,[Measures].[Amount])

select
[measures].[perc] on 0,
[Dim Customer].[Customer ID].children on 1
from [Analysis DW]

但是,当我尝试引用[measure]。[perc]时,我得到一个错误说“当字符串,[measure]时,在多维数据集中找不到'[perc]'成员。[perc] ],已被解析。

请在下面找到错误mdx脚本以供参考 -

with 
 member [measures].[perc] as
([Dim Customer].[Customer ID].currentmember,[Measures].[Amount])

select [measures].[perc]  on 0
from
    (
       select
       [measures].[perc] on 0,
       [Dim Customer].[Customer ID].children on 1
        from [Analysis DW]
     )

2 个答案:

答案 0 :(得分:1)

迟到了,但认为这可能会让有类似问题的人受益。

您的MDX查询失败,因为计算的度量超出了子多维数据集的上下文。您在MDX选择代码段上方声明 [Measures]。[perc] 。因此,按照设计,它后面的选择可见 但是 选择内的子多维数据集不可见。因此,下面一段代码对SSAS引擎毫无意义。

   select
   [measures].[perc] on 0, //Compiler is like .... WHAT THE %@#^ ??
   [Dim Customer].[Customer ID].children on 1
   from [Analysis DW]

和写作一样好

   select
   [measures].[RandomGarbageName] on 0, 
   [Dim Customer].[Customer ID].children on 1
   from [Analysis DW]

希望这有帮助。

答案 1 :(得分:0)

为什么不试试

     with 
     member [measures].[perc] as
     ([Dim Customer].[Customer ID].currentmember,[Measures].[Amount])

     select
     [measures].[perc] on 0,
     [Dim Customer].[Customer ID].children on 1
     from [Analysis DW]