简体   繁体   中英

How can I filter a dimension in MDX Query?

I use SSAS and SQL Server 2008 R2 .

I want select Product that exist inside productcategory that named 'Accessories'.

How I can filter a dimension ?

I write a MDX Query like this :

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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