MDX选择以排除过滤集

时间:2013-12-02 08:32:08

标签: ssas mdx cube

几天来,我一直在尝试正确地编写mdx选项,但每次得到的结果要么是正确的数字还是错误。 我必须计算我的订单,但在2010年排除客户旗1的订单。 基本上,我有一个Fact表,订单+ DIM客户+ DIM日期。比我有:

WITH MEMBER [count] as count(exists([DIM ORDERS].[ORDERS ID].children,
{EXCEPT([DIM CUSTOMER].[FLAG].children,FILTER([DIM CUSTOMER].[FLAG].&[1] ,[DIM CUSTOMER].[FLAG].currentmember IS [DIM_DATE].[YEAR].&[2010]))},
'FACT_ORDERS'))
SELECT [count] on 0 from [Cube]

我哪里错了?这是我的任务的正确MDX。请帮帮我。

1 个答案:

答案 0 :(得分:1)

看起来我误解了问题。在这种情况下,解决方案将是:

WITH MEMBER [YourCount] AS
    IIF( [DIM_DATE].[YEAR].CURRENTMEMBER IS [DIM_DATE].[YEAR].&[2010],
        IIF( NOT([DIM CUSTOMER].[FLAG].CURRENTMEMBER IS [DIM CUSTOMER].[FLAG].&[1]),
            [Measures].[YourMeasureOnOrder],
            NULL)
        ),
    [Measures].[YourMeasureOnOrder])
SELECT 
    NON EMPTY {[YourCount]} ON 0
FROM [Cube]