我正在SSMS 2014中进行多维数据集查询,我的查询返回所有列,甚至包括0和(null)值的列。我理解这是因为日期和客户名称不为空。
使用下面的MDX查询,如何删除包含(null)值的任何列,或者登录时的计数为零?
WITH
MEMBER [2MonthsPriorUniqueUsers] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(2)},[Measures].[App Unique Users Loggedin])
MEMBER [1MonthPriorUniqueUsers] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(1)},[Measures].[App Unique Users Loggedin])
MEMBER [1MonthPriorTotalAppLogins] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(1)},[Measures].[App Logins])
MEMBER [Measures].[PercentUniqueIncreaseMoM] AS ([1MonthPriorUniqueUsers] / [2MonthsPriorUniqueUsers])-1,FORMAT_STRING = "Percent"
SELECT
NON EMPTY
{[Date].[Calendar Year Month].[201705]}
* [Project].[Client Name].members ON 0,
NON EMPTY
{
[Measures].[PercentUniqueIncreaseMoM]
,([1MonthPriorUniqueUsers])
,[2MonthsPriorUniqueUsers]
,[1MonthPriorTotalAppLogins]
} ON 1
FROM [MyCube]
提前致谢!
答案 0 :(得分:0)
您想使用NonEmpty()或Filter()功能。例如,如果您需要根据[Measures]排除空记录。[App Logins]:
WITH
MEMBER [2MonthsPriorUniqueUsers] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(2)},[Measures].[App Unique Users Loggedin])
MEMBER [1MonthPriorUniqueUsers] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(1)},[Measures].[App Unique Users Loggedin])
MEMBER [1MonthPriorTotalAppLogins] AS Sum({[Date].[Calendar Year Month].CurrentMember.Lag(1)},[Measures].[App Logins])
MEMBER [Measures].[PercentUniqueIncreaseMoM] AS ([1MonthPriorUniqueUsers] / [2MonthsPriorUniqueUsers])-1,FORMAT_STRING = "Percent"
SELECT
NON EMPTY
{[Date].[Calendar Year Month].[201705]}
* Filter([Project].[Client Name].members,[Measures].[App Logins]>0) ON 0,
NON EMPTY
{
[Measures].[PercentUniqueIncreaseMoM]
,([1MonthPriorUniqueUsers])
,[2MonthsPriorUniqueUsers]
,[1MonthPriorTotalAppLogins]
} ON 1
FROM [MyCube]