MDX COUNT受MDX查询影响的客户数量

时间:2014-05-14 14:18:37

标签: count ssas mdx

我在查询MDX查询时遇到问题。我有这样的第一个查询:

SELECT { [Measures].[Sale Amount] } ON COLUMNS,  
NON EMPTY FILTER (
    {[Customer].[Full Name].Children} * {[Report].[Name].Children}
    ,
    ([Measures].[Sale Amount] > 100) 
    AND (([Report].[Name].&[Report1]) OR ([Report].[Name].&[Report2])) 
    AND ([Report].[Name].&[Report3]) 
) ON ROWS 
FROM [Default]

这将显示我需要的数据。但是从这里我需要知道有多少客户在这个结果中。为此,我有以下MDX查询

WITH MEMBER MEASURES.X AS Exists(
    [Customer].[Customer Key].Children, 
    FILTER (
    {[Customer].[Full Name].Children} * {[Report].[Name].Children}
    ,
    ([Measures].[Sale Amount] > 100) 
    AND (([Report].[Name].&[Report1]) OR ([Report].[Name].&[Report2])) 
    AND ([Report].[Name].&[Report3]) 
), 'Customer').Count
SELECT Measures.X ON 0 FROM [Default]

(两个查询的过滤区域相同)

此最后一个查询始终返回0结果。我知道客户应该受到此查询影响的客户可以任何人给我一个我做错的提示吗?

由于

1 个答案:

答案 0 :(得分:0)

我只想使用过滤器的计数:

WITH MEMBER MEASURES.X AS
     FILTER (
        {[Customer].[Full Name].Children} * {[Report].[Name].Children}
        ,
        ([Measures].[Sale Amount] > 100) 
        AND (([Report].[Name].&[Report1]) OR ([Report].[Name].&[Report2])) 
        AND ([Report].[Name].&[Report3]) 
    ).Count
SELECT Measures.X ON 0 FROM [Default]