Ssas 除了交叉联接维度查询外,如何执行MDX
考虑以下数据。我想使用MDX获得非{Country:USA&Gender:F} - - - - - - - - - - - - - - - - - - - - - | Country | Gender | Sales | - - - - - - - - - - - - - - - - - - - - - USA M 1000 USA F 500 Spain M 200 Spain F 600 - - - - - - - - - - - - - - - - - - - - - |国家|性别|销售| - - - - - - - - - - - - - - - - - - - - - 美国M 1000 美国F 500 西班牙200米 西班牙F 600 我想提取的是: - - - - - - - - - - - - - - - - - - - - - | Country | Gender | Sales | - - - - - - - - - - - - - - - - - - - - - USA M 1000 Spain M 200 Spain F 600 - - - - - - - - - - - - - - - - - - - - - |国家|性别|销售| - - - - - - - - - - - - - - - - - - - - - 美国M 1000 西班牙200米 西班牙F 600 我尝试使用交叉连接、联合和除此之外的其他方法,例如 WITH SET [Test] AS [Country].[CountryCode].[USA] * Except ([Gender].members,{[Gender].[GenderCode].[F]}) + Except([Country].[CountryCode].members, {[Country].[CountryCode].[USA]}) * [Gender].members SELECT NON EMPTY [Test] ON ROWS, {[Measures].[Sales]} ON COLUMNS FROM [SalesCube] 将[测试]设置为 [国家].[CountryCode].[USA]*除([Gender]。成员,{[Gender].[GenderCode].[F]})+ 除了([Country].[CountryCode]。成员,{[Country].[CountryCode].[USA]})*[性别]。成员 挑选 行上的非空[测试], 列上的{[Measures].[Sales]} 来自[SalesCube] 它是有效的,但是我可以知道有没有其他更简单的方法吗Ssas 除了交叉联接维度查询外,如何执行MDX,ssas,mdx,Ssas,Mdx,考虑以下数据。我想使用MDX获得非{Country:USA&Gender:F} - - - - - - - - - - - - - - - - - - - - - | Country | Gender | Sales | - - - - - - - - - - - - - - - - - - - - - USA M 1000 USA F
谢谢。如果要排除少数组合,可以在交叉连接上使用
Except
,将排除的组合作为元组,如下所示:
WITH SET [Test] AS
Except(CrossJoin([Country].[CountryCode].members,
[Gender].members
),
{ ([Country].[CountryCode].[USA], [Gender].[GenderCode].[F]) }
)
...
从语法上讲,你可以把交叉连接缩写为*
和,除了缩写为-
,还有联合缩写为+
,它们具有通常的优先规则(*
比-
和+
具有更高的优先顺序):
请记住,使用-instead而不是except并不是实际删除集合元素,而是减去度量值。*是交叉连接的简写符号,但-并不完全等同于Except。@nsousa否!像*
可以用作集合上的交叉连接运算符和值上的乘法运算符一样,-
是的别名,但如果用于集合(请参阅文档中用作集合运算符at的减号)以及值上的乘法运算符除外。你是对的,我的印象是错误的。谢谢你。
WITH SET [Test] AS
[Country].[CountryCode].members * [Gender].[GenderCode].members
-
{ ([Country].[CountryCode].[USA], [Gender].[GenderCode].[F]) }
...