问题描述
我有一个 IF 语句(请参见下文),它可以工作,但在某些情况下也会给我真实结果和错误结果。
IF([Payroll History].[Deduction/Benefits Pay History].[Deduction/Benefit Type Code] ='MED'
AND [Payroll History].[Deduction/Benefits Pay History].[Deduction/Benefit Code] <> 'MDHRA')
THEN ([Payroll History].[Deduction/Benefits Pay History].[Deduction])
ELSE ('N')
我只需要真实结果,不需要看到突出显示行的“N”。
您可能知道为什么会发生这种情况,但我不知道如何在结果为 True 时删除带有“N”的原始数据。请参阅下文。
注意 - 我使用的是 Cognos 11(BI UltiPro 报告)
解决方法
以类似这样的范围计算新的扣除额
count(distinct [new deduction] for [company],[year],[employee number])
过滤器
([count deduction] = 1) OR ([count deduction] > 1 and [new deduction] <> 'N')