如何在MDX查询中过滤维度?

时间:2014-01-01 11:40:35

标签: sql-server sql-server-2008-r2 ssas mdx

我使用SSASSQL Server 2008 R2

我希望Product中存在名为“附件”的productcategory

如何过滤维度?

我这样写MDX Query

SELECT 
Filter(
        [Dim Product].[Hierarchy].[ProductCategory] , 
        [Dim Product].[state] =  1
       )
       On Columns
From [Adventure Works DW]

但我收到了一个错误:

Executing the query ...
Query (4, 10) The CURRENTMEMBER function expects a hierarchy expression for the 1    
argument. A member expression was used.

Execution complete

1 个答案:

答案 0 :(得分:2)

无需过滤任何内容:

SELECT    
  [Dim Product].[Hierarchy].[ProductCategory].[Accessories] On Columns 
From [Adventure Works DW]

[编辑]不确定你想要实现什么 - 怎么样 - 仍然不需要这个过滤功能:

SELECT 
  [Dim Product].[Hierarchy].[ProductCategory]  On Columns
From [Adventure Works DW]
where [Dim Product].[state].[1]