我想一次过滤度量和维度上的数据
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
这些我在计算成员中编写的脚本..但它没有成功运行。请帮助我们
答案 0 :(得分:0)
您是否需要在案例中进行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].&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