我可以使用HAVING子句与<>行轴MDX中的运算符

时间:2016-10-02 14:25:06

标签: mdx having

我在执行MDX查询时收到如下所示的错误。

我正在使用HAVING过滤掉[Accessories]

中的English Product Category Name
SELECT 
  {
      (
        [Ship Date].[Hierarchy].[Calendar Year].&[2001]
      : 
        [Ship Date].[Hierarchy].[Calendar Year].&[2004]
      )
    - 
      [Ship Date].[Hierarchy].[Calendar Year].&[2003]
  } ON 0
 ,{
    [Dim Product Category].[English Product Category Name].[English Product Category Name]
  } HAVING 
    [Dim Product Category].[English Product Category Name].MEMBERS
  <> 
    [Dim Product Category].[English Product Category Name].&[Accessories] ON 1
FROM [CubeForMDXReports];

**执行查询...

  

Query(10,1)NotEqualTo函数需要1参数的字符串或数字表达式。使用元组集表达式。   执行完成**

1 个答案:

答案 0 :(得分:0)

您正尝试在HAVING子句中执行此操作:

[Set] <> [Member]

因此例外。

你可以使用Except忽略配件:

SELECT 
  {
      (
        [Ship Date].[Hierarchy].[Calendar Year].&[2001]
      : 
        [Ship Date].[Hierarchy].[Calendar Year].&[2004]
      )
    - 
      [Ship Date].[Hierarchy].[Calendar Year].&[2003]
  } ON 0
 ,Descendants
  (
    Except
    (
      [Dim Product Category].[English Product Category Name].MEMBERS
     ,[Dim Product Category].[English Product Category Name].&[Accessories]
    )
   ,[Dim Product Category].[English Product Category Name].[English Product Category Name]
  ) ON 1
FROM [CubeForMDXReports];