MDX过滤器状态/省份列表中的未知也会删除省份

时间:2013-05-22 14:45:30

标签: filter mdx

我正在尝试从包含省份和州的维度[发货到州]中排除未知。

第一个表达式抛出省份和州,我不知道为什么 -

此mdx仅列出状态(不包括未知,并且由于某种原因,省份):

WITH 
MEMBER measures.ParameterCaption as [Ship To].[Ship To State].currentmember.member_caption

MEMBER measures.ParameterValue as [Ship To].[Ship To State].currentmember.uniquename
SELECT {measures.ParameterCaption, measures.ParameterValue}  ON COLUMNS,
FILTER([Ship To].[Ship To State].children,

[Ship To].[Ship To State].currentmember<>[Ship To].[Ship To State].&[Unknown]

) ON ROWS
FROM [Invoiced Orders]

此mdx正确列出州和省,并排除未知:

WITH 
MEMBER measures.ParameterCaption as [Ship To].[Ship To State].currentmember.member_caption
MEMBER measures.ParameterValue as [Ship To].[Ship To State].currentmember.uniquename
SELECT {measures.ParameterCaption, measures.ParameterValue}  ON COLUMNS,
FILTER([Ship To].[Ship To State].children,

measures.ParameterCaption <> "Unknown"

) ON ROWS
FROM [Invoiced Orders]

1 个答案:

答案 0 :(得分:2)

如果您的比较是已知成员(或成员集),例如您的示例,则可以使用Except()函数直接将其从集合中删除。

Except(
    [Ship To].[Ship To State].children,
    {[Ship To].[Ship To State].&[Unknown]}
)

此处的文档:http://msdn.microsoft.com/en-us/library/ms144900.aspx