需要您的帮助来解决客户报告中的一个问题。
请检查以下2个mdx查询的结果。
注意:我使用了Union运算符,因此我可以将2个成员的结果与1(法国和德国合并)合并。 在Union中使用Exist函数是因为如果它与第二组的维度成员相关,则需要检查函数中的第一个集合。
我使用Union with Exist来实现OR条件。
在第一个MDX查询中,您可以在结果集中找到虚拟集(法国和德国),但在第二个MDX中,您找不到虚拟(法国和德国)集,因为产品类别层次结构与国家/地区和存在功能相关检查虚拟集不是国家层次结构的实际成员,因此它从结果集中删除虚拟集。
是否有任何方法或替代方法,以便我可以强制存在函数在最终结果中显示虚拟集(mDX 2)?
是否有任何方法或替代方法,以便我可以强制存在函数在最终结果中显示虚拟集(mDX 2)?
MDX 1)
WITH
SET [Combined] AS {
[Customer].[Customer Geography].[Country].&[France],
[Customer].[Customer Geography].[Country].&[Germany]
}
MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined])
SELECT
[Measures].[Internet Sales Amount] ON 0,
Union(
Except([Customer].[Customer Geography].[Country], [Combined]),
[Customer].[Customer Geography].[France & Germany]
) ON 1
FROM [Adventure Works]
结果MDX 1
Internet Sales Amount
Australia $9,061,000.58
Canada $1,977,844.86
United Kingdom $3,391,712.21
United States $9,389,789.51
France & Germany $5,538,330.05
MDX查询2)
WITH
SET [Combined] AS {
[Customer].[Customer Geography].[Country].&[France],
[Customer].[Customer Geography].[Country].&[Germany]
}
MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined])
SELECT
[Measures].[Internet Sales Amount] ON 0,
Union( Exists(Except([Customer].[Customer Geography].[Country], [Combined]),
{[Product].[Product Categories].[Category].&[3]}
, "Internet Sales") ,
Exists([Customer].[Customer Geography].[France & Germany],{[Product].[Product Categories].[Category].&[3]}
, "Internet Sales"))
ON 1
FROM [Adventure Works]
结果MDX查询2)
Internet Sales Amount
Australia $9,061,000.58
Canada $1,977,844.86
United Kingdom $3,391,712.21
United States $9,389,789.51
答案 0 :(得分:0)
为什么在第二个查询中需要使用exists两次?
WITH
SET [Combined] AS {
[Customer].[Customer Geography].[Country].&[France],
[Customer].[Customer Geography].[Country].&[Germany]
}
MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined])
SELECT
[Measures].[Internet Sales Amount] ON 0,
Union(
Exists(
Except([Customer].[Customer Geography].[Country], [Combined]),
{[Product].[Product Categories].[Category].&[3]}
,"Internet Sales"
)
//,Exists(
// [Customer].[Customer Geography].[France & Germany]
// ,{[Product].[Product Categories].[Category].&[3]}
// ,"Internet Sales"
// )
,[Customer].[Customer Geography].[France & Germany]
)
ON 1
FROM [Adventure Works];