我是MDX中的新手。我需要過濾所有包含子字符串「SBP1」的記錄。這對我的作品時,我分別輸入每個記錄是這樣的: {[Article].[Article Alternative ID CPG].[SBP1 0],[Article].[Article Alternative ID CPG].[SBP1 1],[Article].[Article Alternative ID CPG].[SBP1 W]}
MDX Builder - 使用INSTR功能進行過濾
工作代碼:
SELECT
NON EMPTY
{[Measures].[Value]} ON COLUMNS
,NON EMPTY
{
[Article].[Article Alternative ID CPG].[Article Alternative ID CPG].ALLMEMBERS*
[Article].[Market].[Market].ALLMEMBERS*
[Article].[Brand].[Brand].ALLMEMBERS*
[Article].[Product].[Product].ALLMEMBERS
}
DIMENSION PROPERTIES
MEMBER_CAPTION
,MEMBER_UNIQUE_NAME
ON ROWS
FROM
(
SELECT
{
[Article].[Article Alternative ID CPG].[SBP1 0]
,[Article].[Article Alternative ID CPG].[SBP1 1]
,[Article].[Article Alternative ID CPG].[SBP1 W]
} ON COLUMNS
FROM
(
SELECT
{[Measure Data Type].[Data Type].[Actuals]} ON COLUMNS
FROM
(
SELECT
{[Org Sales Area].[Sales Organization Key].[DEB1]} ON COLUMNS
FROM
(
SELECT
{[Org Sales Area].[Distribution Channel].&[DO]} ON COLUMNS
FROM
(
SELECT
{[Org Business Unit].[Business Unit].[U-K]} ON COLUMNS
FROM
(
SELECT
{[Measure Item].[Measure Item].&[KF00310]} ON COLUMNS
FROM
(
SELECT
{[Date of Posting].[Posting Y Q M D].[Posting Year].&[2017]} ON COLUMNS
FROM [COLOR LEAN CPG]
)
)
)
)
)
)
)
WHERE
(
[Date of Posting].[Posting Y Q M D].[Posting Year].&[2017]
,[Measure Item].[Measure Item].&[KF00310]
,[Org Business Unit].[Business Unit].[U-K]
,[Org Sales Area].[Distribution Channel].&[DO]
,[Org Sales Area].[Sales Organization Key].[DEB1]
,[Measure Data Type].[Data Type].[Actuals]
)
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAG;
我怎麼能做到這一點與InStr函數更有效率? 我試過,但不起作用:
SELECT
[Measures].[Value] ON COLUMNS
,Filter
(
[Article].[Article Alternative ID CPG].[Article Alternative ID CPG].ALLMEMBERS
,
Instr
(
[Article].[Article Alternative ID CPG].[Article Alternative ID CPG].CurrentMember.Name
,'SBP1'
)
> 0
) ON ROWS
FROM [COLOR LEAN CPG];
有什麼不對我的MDX statament? MDX with my SELECT screenshot 謝謝
謝謝您的回覆,但它似乎仍然是錯誤的(我試過MEMBERCAPTION和CurrentMember.Name):SELECT [Measures]。[Value] ON COLUMNS, Filter([Article]。[Article Alternative ID CPG] [文章備選ID CPG] .ALLMEMBERS, Instr([Article Article。[Article Alternative ID CPG] .CurrentMember.MEMBERCAPTION,'SBP1')> 0)ON ROWS FROM [COLOUR LEAN CPG]; – kabarto
「謝謝你的回覆,但它似乎仍然是錯誤的......」如果我的回答太錯誤,那麼你的解決方案如何使用「[文章] [文章替代ID CPG] .CurrentMember」?嘗試與您的原始實施! (這不會起作用)[文章] [文章替代ID CPG] [文章替代ID CPG] .CurrentMember') – whytheq