简体   繁体   English

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

[英]How can I filter a dimension in MDX Query?

I use SSAS and SQL Server 2008 R2 . 我使用SSASSQL Server 2008 R2

I want select Product that exist inside productcategory that named 'Accessories'. 我想选择名为“附件”的productcategory中存在的Product

How I can filter a dimension ? 我如何过滤尺寸?

I write a MDX Query like this : 我写这样一个MDX Query

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

But I got an error : 但是我收到了一个错误:

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

Execution complete

There is no need of filtering anything : 没有必要过滤任何东西:

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

[edit] not sure to understand what you want to achieve - how about that - still no need of this Filter function : [编辑]不确定你想要实现什么 - 怎么样 - 仍然不需要这个过滤功能:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM