MDX 排除层次结构中存在值的结果

MDX Exclude results where a value exists in a hierarchy

如果我用错了一些术语,请原谅,我对 MDX/OLAP 比较陌生。

我有一个判断道德墙的维度。维度看起来像这样:

Ethical Wall (dimension)
   --> Matter ID (hierarchy)
   --> Walled (hierarchy)
   --> White Listed Initials (hierarchy)
   --> Black Listed Initials (hierarchy)

[Walled] 层次结构包含 true 或 false,具体取决于事项是否应用了墙。

白名单和黑名单层次结构分别包含有权或无权访问某事项的人员的用户姓名首字母。请注意,事项要么是白名单,要么是黑名单,绝不是两者的结合。

我已经能够相对轻松地解释无墙场景和白名单场景,但我在黑名单场景中遇到了很多问题。这是我到目前为止提出的 where 子句:

({
    (
        [Ethical Wall].[Walled].&[True]
        ,[Ethical Wall].[White Listed Initials].&[XXX]
        ,[Ethical Wall].[Black Listed Initials].&[]
    )
    ,(
        [Ethical Wall].[Walled].&[True]
        ,[Ethical Wall].[White Listed Initials].&[]
        ,-{[Ethical Wall].[Black Listed Initials].&[XXX]}
    )
    ,(
        [Ethical Wall].[Walled].&[False]
        ,[Ethical Wall].[White Listed Initials].&[]
        ,[Ethical Wall].[Black Listed Initials].&[]
    )
}) 

剥离并在 table 初始数据集中表示它,我从中过滤,看起来像这样:

我只想 select 首字母 XXX 的用户可以访问的 Ids。从上面应用过滤器我得到所有 3 Ids。我要找的结果集只有Id12。上面的文件管理器匹配如下:

我明白为什么我的过滤器正在检索所有 3 个 Ids,但我不明白如何修改过滤器的中间部分以排除 [=14] =] 正确。这是过滤器的违规部分:

    ,(
        [Ethical Wall].[Walled].&[True]
        ,[Ethical Wall].[White Listed Initials].&[]
        ,-{[Ethical Wall].[Black Listed Initials].&[XXX]}
    )

我怎样才能像这样修改我的过滤器以匹配该数据集?

为什么不能简化成这个?

WHERE
({
    (
        [Ethical Wall].[Walled].&[True]
        ,[Ethical Wall].[White Listed Initials].&[XXX]
    )
    ,(
        [Ethical Wall].[Walled].&[False]
        ,[Ethical Wall].[White Listed Initials].&[]
    )
});

我们找到了解决方案!!

使用集合:

SET notwalled AS exists( 
       selectedmatters, 
       { 
         [Ethical Wall].[Walled].&[False] 
       } 
     ) 
  SET whitelisted AS exists( 
       selectedmatters, 
       { 
         [Ethical Wall].[White Listed Initials].&[XXX] 
       } 
     ) 
  SET blacklisted AS EXCEPT( 
       selectedmatters, 
       exists( 
         selectedmatters, 
         { 
           [Ethical Wall].[Black Listed Initials].&[XXX], 
           [Ethical Wall].[Black Listed Initials].&[] 
         } 
       ) 
     ) 

然后合并:

UNION(notwalled, whitelisted, blacklisted) 

不要再为我哭了