我目前正在尝试从两个单独的多维数据集(我已经管理过)中获取信息,并添加一个总行(使用两者中的数据)。
注释掉的行会产生“不同的维度”错误。我有点理解......但并不完全。自从我上次看MDX以来已经过了几年。
任何指针?
WITH
MEMBER [Computer Department].[Parent Department Key].[Total]
AS ([Computer Department].[Parent Department Key].[All], [Measures].[Fact Computer Specification Count])
MEMBER [User Department].[Parent Department Key].[Total]
AS
LOOKUPCUBE
(
"Directory"
, "
(
[Measures].[Directory Object Count]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
)"
)
MEMBER [Measures].[Department Key]
AS [Computer Department].[Parent Department Key].CurrentMember.Properties("Key")
MEMBER [Measures].[Department Name]
AS [Computer Department].[Parent Department Key].CurrentMember.Properties("Caption")
MEMBER [Measures].[Red Users]
AS
LOOKUPCUBE
(
"Directory"
, "
(
[Measures].[Directory Object Count]
, [Directory Object].[Object Type].&[User]
, [Directory Object].[Migration RAG].&[Red]
, [Department].[Source].&[2]
, [Directory Object].[Directory Name].[All]
, [Directory Object].[Parent Object Key].[All]
, [Location].[Location].[All]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
)"
)
MEMBER [Measures].[Amber Users]
AS
LOOKUPCUBE
(
"Directory"
, "
(
[Measures].[Directory Object Count]
, [Directory Object].[Object Type].&[User]
, [Directory Object].[Migration RAG].&[Amber]
, [Department].[Source].&[2]
, [Directory Object].[Directory Name].[All]
, [Directory Object].[Parent Object Key].[All]
, [Location].[Location].[All]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
)"
)
MEMBER [Measures].[Green Users]
AS
LOOKUPCUBE
(
"Directory"
, "
(
[Measures].[Directory Object Count]
, [Directory Object].[Object Type].&[User]
, [Directory Object].[Migration RAG].&[Green]
, [Department].[Source].&[2]
, [Directory Object].[Directory Name].[All]
, [Directory Object].[Parent Object Key].[All]
, [Location].[Location].[All]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
)"
)
MEMBER [Measures].[Unknown Users]
AS
LOOKUPCUBE
(
"Directory"
, "
(
[Measures].[Directory Object Count]
, [Directory Object].[Object Type].&[User]
, [Directory Object].[Migration RAG].&[Unknown]
, [Department].[Source].&[2]
, [Directory Object].[Directory Name].[All]
, [Directory Object].[Parent Object Key].[All]
, [Location].[Location].[All]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
)"
)
MEMBER [Measures].[Total RAGU Users]
AS
LOOKUPCUBE
(
"Directory"
, "
AGGREGATE
(
([Measures].[Directory Object Count]
, [Directory Object].[Object Type].&[User]
, [Department].[Source].&[2]
, [Directory Object].[Directory Name].[All]
, [Directory Object].[Parent Object Key].[All]
, [Location].[Location].[All]
, [Department].[Parent Department Key].&[" + [Measures].[Department Key] + "]
, EXCEPT([Directory Object].[Migration RAG].Children, [Directory Object].[Migration RAG].&[Unknown])
)
)
"
)
MEMBER [Measures].[Red Computers]
AS ([Measures].[Fact Computer Specification Count], [Computer].[Migration RAG].&[Red])
MEMBER [Measures].[Amber Computers]
AS ([Measures].[Fact Computer Specification Count], [Computer].[Migration RAG].&[Amber])
MEMBER [Measures].[Green Computers]
AS ([Measures].[Fact Computer Specification Count], [Computer].[Migration RAG].&[Green])
MEMBER [Measures].[Unknown Computers]
AS ([Measures].[Fact Computer Specification Count], [Computer].[Migration RAG].&[Unknown])
MEMBER [Measures].[Total RAGU Computers]
AS
AGGREGATE
(
(
EXCEPT([Computer].[Migration RAG].Children, [Computer].[Migration RAG].&[Unknown])
)
, [Measures].[Fact Computer Specification Count]
)
SELECT
{
[Measures].[Department Name]
, [Measures].[Red Users]
, [Measures].[Amber Users]
, [Measures].[Green Users]
, [Measures].[Unknown Users]
, [Measures].[Total RAGU Users]
, [Measures].[Red Computers]
, [Measures].[Amber Computers]
, [Measures].[Green Computers]
, [Measures].[Unknown Computers]
, [Measures].[Total RAGU Computers]
} ON COLUMNS,
{
{
ORDER
(
EXCEPT
(
DESCENDANTS([Computer Department].[Parent Department Key].[All], 1, SELF)
, [Computer Department].[Parent Department Key].[All].DataMember
)
, [Measures].[Department Name]
, BASC
)
, [Computer Department].[Parent Department Key].[Total]
-- , [User Department].[Parent Department Key].[Total]
}
} ON ROWS
FROM [Hardware Inventory]
WHERE
(
[Computer Department].[Source].&[2]
, [Computer Directory Object].[Directory Name].[All]
, DESCENDANTS([Computer Directory Object].[Parent Object Key].[All], 0, SELF)
, [Computer Location].[Location].[All]
)