MDX查询中Where子句的比较

时间:2011-11-18 05:54:00

标签: mdx mondrian

在MDX查询中,如何比较级别值是否小于某个值。 例如

SELECT NON EMPTY
    [Sales Territory].[Sales Territory Country].Members ON 0,
    [Product].[Category].[Clothing] ON 1
FROM
    [Adventure Works]
WHERE
    ([Measures].[LowGPM] > 120)

此MDX查询无效。

另外,我也试过WITH Clause。

WITH Member [Measures].[Calculated Measures] as
     IIF ([Measures].[LowGPM] < 120, [Measures].[LowGPM], null)

SELECT NON EMPTY
    [Sales Territory].[Sales Territory Country].Members ON 0,
    [Product].[Category].[Clothing] ON 1
FROM
    [Adventure Works]
WHERE
    ([Measures].[LowGPM] > 120)

显示蒙德里安错误:MDX object '[Measures].[Calculated Measures]' not found in cube

1 个答案:

答案 0 :(得分:4)

您可以像这样过滤轴:

SELECT
  [Measures].[Internet Sales Amount] ON 0,
  Filter(
    [Customer].[Country].Members, 
    ([Measures].[Internet Sales Amount] > 2000000) 
        AND ([Measures].[Internet Sales Amount] < 5000000)
  ) ON 1
FROM [Adventure Works]