我正在开发一个生成 MDX 的查询生成器应用程序,并尝试使用以下方法从多维数据集获取客户计数,这工作得很好:
WITH MEMBER MEASURES.X AS (
{ [Customer].[Gender].[Female]},
[Customer].[Customer].Children
).Count
SELECT Measures.X ON 0 FROM [Adventure Works]
但是,如果用户拖入与客户无关的维度,例如:
WITH MEMBER MEASURES.X AS (
{ [Customer].[Gender].[Female]},
{ [Employee].[Status].[Active], [Employee].[Status].[Inactive]},
[Customer].[Customer].Children
).Count
SELECT Measures.X ON 0 FROM [Adventure Works]
计数结果显然变得不正确。
有没有办法确定一个维度是否与客户相关,以便我可以将其从生成的 MDX 查询中排除?