我正在从Profiler获取的SSMS中执行以下MDX查询:
SELECT {
[Measures].[Dollar Amount],
[Measures].[Transaction Count]}
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS,
NON EMPTY Hierarchize({DrilldownLevel({[Retail Sales Date].[Month].[All]},,,INCLUDE_CALC_MEMBERS)})
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS
FROM [Retail Sales Cube]
WHERE ([Geography].[Retail Sales Location].[Country Name].&[Australia],[Retail Category].[Retail Category].[All])
CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
这将产生以下结果(仅摘要):
行是月,由于检索方法的原因,我还需要在列中显示月。
所以我尝试了这个:
WITH
MEMBER [TheDate] AS [Retail Sales Date].[Month].CurrentMember.Name
SELECT {
[TheDate],
[Measures].[Dollar Amount],
[Measures].[Transaction Count]}
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS,
NON EMPTY Hierarchize({DrilldownLevel({[Retail Sales Date].[Month].[All]},,,INCLUDE_CALC_MEMBERS)})
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS
FROM [Retail Sales Cube]
WHERE ([Geography].[Retail Sales Location].[Country Name].&[Australia],[Retail Category].[Retail Category].[All])
CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
我知道这里没有秘密,但是我不知道该放在哪里。如何摆脱空行?
答案 0 :(得分:0)
也许下面的表达式可以解决问题:
WITH
MEMBER [TheDate] AS
IIF( !isEmpty( [Dollar Amount] )
[Retail Sales Date].[Month].CurrentMember.Name,
null
)