[英]How to filter a dimension hierarchy based on another dimension hierarchy in mdx
I have a sender and recipient dimensions which are role playing dimensions out of employee physical table. 我有一个发件人和收件人维度,这是员工实际表中角色扮演的维度。 My fact table has sender, recipient ,messages columns. 我的事实表有发件人,收件人,消息列。 I want to get messages sent from a employee to everyone in the company except those reporting to his manager. 我想让员工发送的消息发送给公司中的每个人,但向经理报告的消息除外。 I tried something like this 我尝试过这样的事情
WITH
SET [Others] AS
Except
(
Ascendants([Recipient].[Manager])
,[Sender].[Manager].Parent
)
SELECT
[OTHERS] ON COLUMNS
,{[Measures].[Messages]} ON ROWS
FROM [cube]
WHERE
[Sender].[Manager].&[xyz];
Basic idea is..get all ascendants of the recipients of a given sender and filter those whose ascendant list consists of senders parent. 基本思想是..获取给定发件人的所有收件人,并筛选其父级列表由发件人父级组成的收件人。
This doesn't work because I can't do except between two different dimension hierarchies. 这是行不通的,因为除了两个不同的维度层次结构之间,我无法做。
Try making the Set
more context aware via the keyword EXSITING
and then use Filter to compare member_caption
尝试通过关键字EXSITING
使Set
具有更多上下文意识,然后使用Filter比较member_caption
WITH
MEMBER [Measures].[SenderName] AS
[Sender].CurrentMember.Member_Caption
SET [ExistingRecip] AS
(EXISTING
[Recipient].[Manager].MEMBERS)
SET [Others] AS
Filter
(
[ExistingRecip]
,
[ExistingRecip].Item(
[ExistingRecip].CurrentOrdinal - 1).Member_Caption
<>
[Measures].[SenderName]
)
SELECT
[OTHERS] ON COLUMNS
,{[Measures].[Messages]} ON ROWS
FROM [cube]
WHERE
[Sender].[Manager].&[xyz];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.