2
WITH
MEMBER [Measures].[LevelName] AS
[Employee].[Employee Department].CurrentMember.Level.Name
MEMBER [Measures].[LevelNumber] AS
[Employee].[Employee Department].CurrentMember.Level.Ordinal
MEMBER [Measures].[MemName] AS
[Employee].[Employee Department].CurrentMember.Name
SET [Set_TargetEmp] AS
{
FILTER(
[Employee Department].AllMembers,
(
InStr(
1,
[Employee].[Employee Department].currentmember.name,
"WC4") <> 0
)
)
}
SELECT
{
[Measures].[MemName],
[Measures].[LevelName],
[Measures].[LevelNumber]
} ON 0,
Hierarchize(
Generate([Set_TargetEmp] as e,
Ascendants(e.Current)
+
Descendants(e.Current, e.Current.Level, SELF_AND_AFTER)
)
)
ON 1
FROM [Adventure Works]
我想打一個小的變化,但新的成員得到了下面的感謝@FrankPI(魯本H. D'SA)誰是關鍵53,沒有出現在結果集中。爲什麼?
WITH
MEMBER [Measures].[LevelName] AS
[Employee].[Employee Department].CurrentMember.Level.Name
MEMBER [Measures].[LevelNumber] AS
[Employee].[Employee Department].CurrentMember.Level.Ordinal
MEMBER [Measures].[MemName] AS
[Employee].[Employee Department].CurrentMember.Name
SET [Set_TargetEmp] AS
{
FILTER(
[Employee Department].AllMembers,
(
InStr(
1,
[Employee].[Employee Department].currentmember.name,
"David P. Hamilton") <> 0
)
or
[Employee].[Employee Department].currentmember.member_key = 53 //<<<<<<new bit
)
}
SELECT
{
[Measures].[MemName],
[Measures].[LevelName],
[Measures].[LevelNumber]
} ON 0,
Hierarchize(
Generate([Set_TargetEmp] as e,
Ascendants(e.Current)
+
Descendants(e.Current, e.Current.Level, SELF_AND_AFTER)
)
)
ON 1
FROM [Adventure Works]
也許我應該使用'IS'而不是'='....將嘗試。這是奇怪的語法弗蘭克'.Properties(「Key0」,鍵入)'你有任何進一步的參考幫助我理解它? – whytheq
我不認爲'''會對這裏有所幫助,因爲它是爲了成員身份,在'IS'的兩邊都有成員。但是你在這裏使用字符串和數字。我沒有嘗試,但也許'=「53」'也可以。我會認爲'member_key'返回一個字符串。 – FrankPl
(+1恥你領域不是t-sql弗蘭克 - 認爲你的代表將是50k,而不是5k然後!....很高興你在這裏,因爲MDX的答案很難找到....我是現在會打綠色的滴答聲:5,000煙花節目開始) – whytheq