希望您做得很好,我编写了一个MDX查询,如下所示:
with member [Measures].[TOTAL] AS
SUM(Periodstodate([DimTime].[Year].[(All)] ,[DimTime].[Year].currentmember)
,[Measures].[IndentCount])
Select {[Measures].[IndentCount],[Measures].[TOTAL]}
having [Measures].[IndentCount] > 0 on 0 ,
non empty [DimTime].[Year].[Year] on 1
from [Procurement]问题是,尽管使用了having [Measures].[IndentCount] > 0,但我仍然看到度量的null值,如下所示:

。我想知道问题是什么?即使我使用Filter函数,我也有这个问题。
提前感谢
发布于 2019-04-15 01:22:03
您将HAVING子句放在ON COLUMNS轴(或ON 0)中,该轴试图筛选出任何具有空或零IndentCount的列。相反,您需要将其移动到ON ROWS轴(或ON 1),如果您希望它消除某些行的话。
我还建议您可以使用NonEmpty函数而不是HAVING来优化性能。由于您不能有一个零或负IndentCount,下面的操作将执行您想要的,并将更好地执行,因为它将只计算您最终将保持的行的总度量。
with member [Measures].[TOTAL] AS
SUM(Periodstodate([DimTime].[Year].[(All)] ,[DimTime].[Year].currentmember)
,[Measures].[IndentCount])
Select {[Measures].[IndentCount],[Measures].[TOTAL]}
on 0 ,
NonEmpty([DimTime].[Year].[Year], [Measures].[IndentCount]) on 1
from [Procurement]https://dba.stackexchange.com/questions/234170
复制相似问题