MDX:如何消除列式空值

时间:2017-04-24 14:20:57

标签: ssas mdx

如何消除MDX中的列式空值?

enter image description here

WITH MEMBER [ReportName] AS [DimReport].[Report Key].CurrentMember.Member_Caption
     MEMBER [ReportKey] AS [DimReport].[Report Key].CurrentMember.UniqueName
     MEMBER [ReportWiseLatestDate] AS TAIL(NonEmpty([DimAnchorDate].[Date Key].[Date Key],[Measures].[DrPatientKeyCnt]),1).Item(0).MemberValue 
SELECT 
    {[ReportName],[ReportKey],[ReportWiseLatestDate]} ON COLUMNS,
    {[DimReport].[Report Key].[Report Key]} ON ROWS
FROM 
    [PopulationReportCube]

1 个答案:

答案 0 :(得分:2)

NonEmpty()函数可以解决问题:

WITH MEMBER [ReportName] AS [DimReport].[Report Key].CurrentMember.Member_Caption
     MEMBER [ReportKey] AS [DimReport].[Report Key].CurrentMember.UniqueName
     MEMBER [ReportWiseLatestDate] AS TAIL(NonEmpty([DimAnchorDate].[Date Key].[Date Key],[Measures].[DrPatientKeyCnt]),1).Item(0).MemberValue 
SELECT 
{[ReportName],[ReportKey],[ReportWiseLatestDate]} ON COLUMNS,
NonEmpty({[DimReport].[Report Key].[Report Key]}, [ReportWiseLatestDate]) ON ROWS
FROM 
[PopulationReportCube]