【问题标题】:I need a quick help on the below mdx query我需要有关以下 mdx 查询的快速帮助
【发布时间】:2016-03-05 15:21:06
【问题描述】:

我想一次过滤度量和维度上的数据

case 
when [measure].[frequency] >3 and [poa].[segment].&A then 'red'
when [measure].[frequency] <3 and [poa].[segment].&A then 'yellow'
when [measure].[frequency] =3 and [poa].[segment].&A then 'Green'
else 'NA' end

这些是我在计算成员中编写的脚本..但它没有成功运行。请帮助我们

【问题讨论】:

  • 为什么它不起作用?您是否得到错误或不正确的结果?提供错误结果的屏幕截图和您想要的结果。
  • 它显示像#valueerr这样的错误
  • 这不是帮助台,您可以要求我们尽快答复。
  • @AdiT 请安装 OLAP 数据透视表扩展,然后右键单击 #VALUE!单元格并获得更好的错误消息。 olappivottableextend.codeplex.com/…

标签: sql-server sql-server-2008 mdx mdxstudio mdxclient


【解决方案1】:

是否需要在 case 中放置 currentMember 比较?

我想这样可以吗?

case 
when [measure].[frequency] >3 then 'red'
when [measure].[frequency] <3 then 'yellow'
when [measure].[frequency] =3 then 'Green'
else 'NA' 
end

虽然你必须使用'NA'?这种情况可以不用null吗?

case 
when [measure].[frequency] >3 then 'red'
when [measure].[frequency] <3 then 'yellow'
when [measure].[frequency] =3 then 'Green'
else NULL 
end

你计算的另一部分看起来需要将[poa].[segment].&amp;A 与使用IS 运算符的东西进行比较,如下所示:

([poa].CURRENTMEMBER IS [poa].[segment].&A)

因此将其添加到case 语句中:

CASE
WHEN [measure].[frequency] >3 
        AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'red'
WHEN [measure].[frequency] <3 
        AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'yellow'
WHEN [measure].[frequency] =3 
        AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'Green'
ELSE NULL 
END

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-30
    • 2011-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多