-1

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

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

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

4

1 回答 1

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

你 calc 的另一部分看起来需要[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
于 2016-03-06T09:22:42.337 回答