我的情况是模型中有两个不同的尺寸。尺寸A具有ColorId,FirstColor和SecondColor。尺寸B具有ColorId和Firstcolor。我试图从两个不同的维度获得一个完整的colorId列表。请记住,这个mdx需要在ssrs中使用。
尺寸A
ColorId FirstColor SecondColor
T0z17 Blue Green
T0lqa Red Yellow
维度B
ColorId FirstColor
T201k Black
Tph1v Orange
预期输出(仅1列)
ColorId
T0z17
T0lqa
T201k
Tph1v
答案 0 :(得分:2)
尝试使用此联合查询:
$body = <<< TEXT
Hi {$user},
Thank you for registering with us, here is your registration information.
Login Username: {$user}
Email: {$user_email}
Password: ==SECRET==
You can update it anytime by going to {$site_url}
Thanks
{$site_name}
TEXT;
答案 1 :(得分:2)
由于格雷格的回答并不是真正的不同,我会用以下方式修复他的代码:
With
Member [Measures].[SameColor] as
IIF(
[Dimension A].[Color Id].CurrentMember.Name = [Dimension B].[Color Id].CurrentMember.Name,
1,
NULL
)
Member [Measures].[OnlyAColor] as
IIF(
IsEmpty(
LinkMember(
[Dimension A].[Color Id].CurrentMember,
[Dimension B].[Color Id]
)
),
1,
NULL
)
Member [Measures].[OnlyBColor] as
IIF(
IsEmpty(
LinkMember(
[Dimension B].[Color Id].CurrentMember,
[Dimension A].[Color Id]
)
),
1,
NULL
)
Member [Measures].[Color] as
IIF(
[Dimension A].[Color Id].CurrentMember is [Dimension A].[Color Id].[All],
[Dimension B].[Color Id].CurrentMember.Name
[Dimension A].[Color Id].CurrentMember.Name
)
Select [Measures].[Color] on 0,
NonEmpty(
[Dimension A].[Color Id].[Color Id].Members * [Dimension B].[Color Id].[Color Id].Members,
[Measures].[SameColor]
)
+
NonEmpty(
[Dimension A].[Color Id].[Color Id].Members * [Dimension B].[Color Id].[All],
[Measures].[OnlyAColor]
)
+
NonEmpty(
[Dimension A].[Color Id].[All] * [Dimension B].[Color Id].[Color Id].Members,
[Measures].[OnlyBColor]
) on 1
From [YourCube]