如何显示measure为null的层次结构成员(mdx)

时间:2014-04-04 09:34:50

标签: reporting-services ssas mdx

我想在SSRS中显示包含null度量成员的层次结构。 mdx查询中的问题是,当我删除NON EMPTY clouse时,我得到'System.OutOfMemoryException',因为 时间,产品和层次结构维度之间的大交叉连接。知道如何独家吗?查询如下:

SELECT 
NON EMPTY  { (
[Measures].[SOME MEASURE]
   )} ON COLUMNS,
   NON EMPTY { (
[Organization Structure].[Description].[Description].Allmembers
* [Organization Structure].[ID].[ID]
* [Organization Structure].[ParentID].[ParentID]
*[Products].[Name].[Name]
*[Time].[Hierarchy].[MothsAndDays]
)} 
DIMENSION
 PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, PARENT_UNIQUE_NAME, 
 LEVEL_NUMBER ON ROWS 
 FROM [MyCube]

2 个答案:

答案 0 :(得分:1)

你可以使用NonEmpty(无间隙)函数代替您可以摆脱空值的层次结构吗?例如:

SELECT 
//NON EMPTY  
{ (
[Measures].[SOME MEASURE]
   )} ON COLUMNS,
//NON EMPTY 
{ (
[Organization Structure].[Description].[Description].Allmembers
* NONEMPTY([Organization Structure].[ID].[ID],[Measures].[SOME MEASURE])
* [Organization Structure].[ParentID].[ParentID]
* NONEMPTY([Products].[Name].[Name],[Measures].[SOME MEASURE])
* [Time].[Hierarchy].[MothsAndDays]
)} 
DIMENSION
 PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, PARENT_UNIQUE_NAME, 
 LEVEL_NUMBER ON ROWS 
FROM [MyCube]

答案 1 :(得分:1)

假设您在Reporting Services服务器上而不是Analysis Services服务器上出现内存问题,您可以使用HAVING选择部分末尾的ROWS子句而不是{{1在它的开头限制行:

NON EMPTY

由于您没有准确说明要如何确定要显示的行,我将其保留为上面的SELECT NON EMPTY { ( [Measures].[SOME MEASURE] )} ON COLUMNS, [Organization Structure].[Description].[Description].Allmembers * [Organization Structure].[ID].[ID] * [Organization Structure].[ParentID].[ParentID] *[Products].[Name].[Name] *[Time].[Hierarchy].[MothsAndDays] DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, PARENT_UNIQUE_NAME, LEVEL_NUMBER HAVING <whatever the condition is to display a row> ON ROWS FROM [MyCube] 。这种方式的工作方式是Analysis Services首先为所有行层次结构的完整跨产品构建结果集,然后评估条件以从中删除行。