MDX计算成员错误

时间:2014-11-05 16:24:12

标签: mdx data-warehouse mondrian

怎样才能成为计算成员?我收到此错误Mondrian Error:Member expression 'Filter(Descendants([User].[User Name].Members), ([User].[User Name].CurrentMember.Properties("location") = 'foo'))不能是一组

WITH MEMBER [Measures].[some users] AS
Filter(
  Descendants([User].[User Name].Members), 
  [User].[User Name].CurrentMember.Properties("location") = 'foo'
 )  
)

SELECT
 NON EMPTY {[Measures].[some users]} ON COLUMNS,
 NON EMPTY CrossJoin(
   [Date].[Date].Members, 
   [Customer].[Customer Name].Members
  ) ON ROWS

FROM [Users]

1 个答案:

答案 0 :(得分:1)

FILTER返回SET,您已尝试将其分配到MEMBER子句中的WITH

这应该有效,但没有指定任何措施,因此您将获得默认度量:

SELECT
 NON EMPTY 
{Filter(
  Descendants([User].[User Name].Members), 
  [User].[User Name].CurrentMember.Properties("location") = 'foo'
 ) } 
ON COLUMNS,
 NON EMPTY CrossJoin(
   [Date].[Date].Members, 
   [Customer].[Customer Name].Members
  ) ON ROWS

FROM [Users];

您可以在WHERE子句中决定某个度量:

SELECT
 NON EMPTY 
{Filter(
  Descendants([User].[User Name].Members), 
  [User].[User Name].CurrentMember.Properties("location") = 'foo'
 ) } 
ON COLUMNS,
 NON EMPTY CrossJoin(
   [Date].[Date].Members, 
   [Customer].[Customer Name].Members
  ) ON ROWS

FROM [Users]
WHERE [Measures].[aMeasureThatFitsContext];

使用RANK的示例。只是有点不确定这是如何适合你的原始脚本?

WITH 
  SET [myFilteredSet] AS 
    Filter(
      Descendants([User].[User Name].Members), 
      [User].[User Name].CurrentMember.Properties("location") = 'foo'
    )
  MEMBER [Measures].[userRank] AS
    RANK(
      [User].[User Name].CURRENTMEMBER,
      [myFilteredSet],
      [Measures].[EXISTING_MEASURE] //<<this is the measure you are ordering by  
    ) 
SELECT
 NON EMPTY 
   {[Measures].[EXISTING_MEASURE],[Measures].[userRank] } 
 ON COLUMNS,
 NON EMPTY 
   [myFilteredSet] 
 ON ROWS
FROM [Users]