我有以下表达式MDX:
isnull([Measures].[Available Hours],0)
处理完立方体后,我在报告中遇到以下错误:
未找到存储过程的适当重载功能 。参数不正确.MdxScript执行托管 存储过程isnull失败,出现以下错误:Microsoft AnalysisServices AdomdServer AdomdException
如何解决错误?
答案 0 :(得分:1)
isnull
不是mdx
函数。
要在null
中测试mdx
,请尝试使用iif
iif(
[Measures].[Available Hours] = 0,
0,
[Measures].[Available Hours]
)
当我们寻找0时看起来有点奇怪,然后如果它是0则将其改为0 !!
但这是一个例子:
WITH
MEMBER [Measures].[Internet Sales Amount 2] AS
IIF
(
[Measures].[Internet Sales Amount] = 0
,0
,[Measures].[Internet Sales Amount]
)
SELECT
{
[Measures].[Internet Sales Amount]
,[Measures].[Internet Sales Amount 2]
} ON 0
,
[Customer].[Customer Geography].[Country].MEMBERS
*
[Product].[Category].MEMBERS ON 1
FROM [Adventure Works];
这就是:
修改
@MarcPolizzi的替代方案做同样的事情,他的代码更紧凑:
WITH
MEMBER [Measures].[Internet Sales Amount 2] AS
IIF
(
[Measures].[Internet Sales Amount] = 0
,0
,[Measures].[Internet Sales Amount]
)
MEMBER [Measures].[Internet Sales Amount 3] AS
CoalesceEmpty
(
[Measures].[Internet Sales Amount]
,0
)
SELECT
{
[Measures].[Internet Sales Amount]
,[Measures].[Internet Sales Amount 2]
,[Measures].[Internet Sales Amount 3]
} ON 0
,
[Customer].[Customer Geography].[Country].MEMBERS
*
[Product].[Category].MEMBERS ON 1
FROM [Adventure Works];
答案 1 :(得分:1)
您可以使用CoalesceEmpty函数替换null / empty值。要用0值替换它们,您可以执行以下操作:
CoalesceEmpty([Measures].[Available Hours], 0)
希望有所帮助。