MDX到SSAS计算

时间:2011-11-21 21:13:53

标签: ssas mdx

我编写了一个MDX查询,可以在SQL Server Management Studio中正常运行。我的查询如下:

SELECT [Measures].[Item Count] 
ON 0 
FROM [Inventory]
where [DateDiscontinued].[Date].[Discontinued Cal Year].&[0].&[0]

这个查询给了我所有Discontinues的项目。现在的问题是,当我将BIDS(SSAS Cube Calculation)中的查询粘贴为计算成员时,我得到一个错误。它说它无法读取select语句。我是否需要编写不同的MDX以支持SSAS计算成员或支持SSAS计算Memeber的不同功能?

1 个答案:

答案 0 :(得分:2)

create member right syntax是:

CREATE [ SESSION ] [HIDDDEN] [ CALCULATED ] MEMBER CURRENTCUBE | Cube_Name.Member_Name 
   AS MDX_Expression
      [,Property_Name = Property_Value, ...n]
......[,SCOPE_ISOLATION = CUBE]

然后,您的创建成员应该是:

CREATE MEMBER CURRENTCUBE.Measures.MyMeasure AS
([Measures].[Item Count] , 
 [DateDiscontinued].[Date].[Discontinued Cal Year].&[0].&[0])