我需要在现有MDX中添加一列,其值应为1,1,1,1和2,2,2,如下所示。
Top line income 1
Products (GL) 1
Net Interest Income (NII) 1
Non Interest Revenue (NIR) 1
Products ( Non GL) 1
Net Interest Income (NII) 1
Non Interest Revenue (NIR) 1
WIP (No. of Prospects Logged) 2
WIP (Prospects Total Amount) Exposure 2
WIP (Prospects Total Amount) Deposits 2
Accepted Payouts in Progress (volume) 2
Accepted Payouts in Progress Exposure 2
Approval Rate (%) 2
Rejection Rate (Not taken up) (%) 2
...
...
如何在现有查询中实现此目的?
MDX:
WITH
MEMBER [Measures].[Measure_Key] AS
[ScoreCardMeasures].[ScoreCard].Member_Key
MEMBER [Measures].[Measure_Group_Key] AS
[ScoreCardMeasures].[ScoreCard].Parent.Member_Key
MEMBER [Measures].[Structure_Level] AS
[CustomerStructure].[Provincial Structure].LEVEL_NUMBER
SET [ReportLevel] AS
Filter
(
[Report Levels].[Report Level].[Report Level]
,
Cint([Report Levels].[Report Level].Properties("Structure Level"))
=
Cint([Measures].[Structure_Level])
)
MEMBER [Measures].[Sequence] AS
[ScoreCardMeasures].[ScoreCard].Properties("Sequence")
MEMBER [Measures].[Indent] AS
[ScoreCardMeasures].[ScoreCard].Properties("Font Indent")
MEMBER [Measures].[Weight] AS
[ScoreCardMeasures].[ScoreCard].Properties("Font Weight")
MEMBER [Measures].[Header] AS
[ScoreCardMeasures].[ScoreCard].Properties("Values Header")
MEMBER [Measures].[Header1Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name1")
MEMBER [Measures].[Header2Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name2")
MEMBER [Measures].[Header3Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name3")
MEMBER [Measures].[Actual] AS
[Measures].[Measure Value]
MEMBER [Measures].[Target] AS
[Measures].[Measure Target]
MEMBER [Measures].[Average] AS
[Measures].[Average Value]
SELECT
{
[Measures].[Measure_Key]
,[Measures].[Measure_Group_Key]
,[Measures].[Structure_Level]
,[Measures].[Sequence]
,[Measures].[Indent]
,[Measures].[Weight]
,[Measures].[Header]
,[Measures].[Header1Caption]
,[Measures].[Header2Caption]
,[Measures].[Header3Caption]
,[Measures].[Actual]
,[Measures].[Target]
,[Measures].[Average]
} ON COLUMNS
,{
Filter
(
[ReportLevel]
*
Order
(
Descendants
(
StrToMember(@Financial_Measure)
,[ScoreCardMeasures].[ScoreCard].[Measure Code]
,LEAVES
)
,[Measures].[Sequence]
,ASC
)
,
[Measures].[Active Indicator] <> 0
)
} ON ROWS
FROM [ScoreCard]
WHERE
(
StrToMember(@SiteStructure)
,StrToMember(@Time)
);
答案 0 :(得分:0)
我不完全明白你是如何决定它应该是1还是2 - 这个问题并没有说清楚。
如果您只是想将其硬编码到mdx中,那么这可能是一种方法:
WITH
MEMBER [Measures].[Measure_Key] AS
[ScoreCardMeasures].[ScoreCard].Member_Key
MEMBER [Measures].[Measure_Group_Key] AS
[ScoreCardMeasures].[ScoreCard].Parent.Member_Key
MEMBER [Measures].[Structure_Level] AS
[CustomerStructure].[Provincial Structure].LEVEL_NUMBER
SET [ReportLevel] AS
Filter
(
[Report Levels].[Report Level].[Report Level]
,
Cint([Report Levels].[Report Level].Properties("Structure Level"))
=
Cint([Measures].[Structure_Level])
)
MEMBER [Measures].[Sequence] AS
[ScoreCardMeasures].[ScoreCard].Properties("Sequence")
MEMBER [Measures].[Indent] AS
[ScoreCardMeasures].[ScoreCard].Properties("Font Indent")
MEMBER [Measures].[Weight] AS
[ScoreCardMeasures].[ScoreCard].Properties("Font Weight")
MEMBER [Measures].[Header] AS
[ScoreCardMeasures].[ScoreCard].Properties("Values Header")
MEMBER [Measures].[Header1Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name1")
MEMBER [Measures].[Header2Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name2")
MEMBER [Measures].[Header3Caption] AS
[ScoreCardMeasures].[ScoreCard].Properties("Header Name3")
MEMBER [Measures].[Actual] AS
[Measures].[Measure Value]
MEMBER [Measures].[Target] AS
[Measures].[Measure Target]
MEMBER [Measures].[Average] AS
[Measures].[Average Value]
MEMBER [Measures].[1or2] AS
CASE
WHEN
[ScoreCardMeasures].[ScoreCard].CurrentMember
IS
[ScoreCardMeasures].[ScoreCard].[Measure Code].[Top Line Income]
THEN 1
WHEN
[ScoreCardMeasures].[ScoreCard].CurrentMember
IS
[ScoreCardMeasures].[ScoreCard].[Measure Code].[Products (GL)]
THEN 1
WHEN
[ScoreCardMeasures].[ScoreCard].CurrentMember
IS
[ScoreCardMeasures].[ScoreCard].[Measure Code].[WIP (No. of Prospects Logged)]
THEN 2
WHEN
[ScoreCardMeasures].[ScoreCard].CurrentMember
IS
[ScoreCardMeasures].[ScoreCard].[Measure Code].[WIP (Prospects Total Amount) Exposure]
THEN 2
END
SELECT
{
[Measures].[Measure_Key]
,[Measures].[Measure_Group_Key]
,[Measures].[Structure_Level]
,[Measures].[Sequence]
,[Measures].[Indent]
,[Measures].[Weight]
,[Measures].[Header]
,[Measures].[Header1Caption]
,[Measures].[Header2Caption]
,[Measures].[Header3Caption]
,[Measures].[Actual]
,[Measures].[Target]
,[Measures].[Average]
,[Measures].[1or2]
} ON COLUMNS
,{
Filter
(
[ReportLevel]
*
Order
(
Descendants
(
StrToMember(@Financial_Measure)
,[ScoreCardMeasures].[ScoreCard].[Measure Code]
,LEAVES
)
,[Measures].[Sequence]
,ASC
)
,
[Measures].[Active Indicator] <> 0
)
} ON ROWS
FROM [ScoreCard]
WHERE
(
StrToMember(@SiteStructure)
,StrToMember(@Time)
);