我遇到了Case Case的问题,这是在Netsuite的Saved Search中使用的,但报告数据库是在Oracle上运行的。我们根据客户调查中的问题计算净推荐值(NPS)。以下是一个工作示例:
SUM(Case When {custrecord_rsm_csf_rec} = 'Very Likely' Then 1 Else 0 End -
Case When {custrecord_rsm_csf_rec} = 'Neither Likely or Unlikely' Then 1
When {custrecord_rsm_csf_rec} = 'Unlikely' then 1
When {custrecord_rsm_csf_rec} = 'Very Unlikely' then 1 Else 0 End)
/count({internalid})
我要做的是添加to_char({created}),'MM')= xx,将结果按月返回结果分组。经过许多不同的尝试之后,我没有运气,所有尝试看起来都像下面这样:
SUM(Case When {custrecord_rsm_csf_rec} = 'Very Likely' AND
to_char({created}), 'MM') = 03 Then 1 Else 0 End -
Case When {custrecord_rsm_csf_rec} = 'Neither Likely or Unlikely' AND
to_char({created}), 'MM') = 03 Then 1
When {custrecord_rsm_csf_rec} = 'Unlikely' AND to_char({created}), 'MM') =
03 then 1
When {custrecord_rsm_csf_rec} = 'Very Unlikely' AND to_char({created}),
'MM') = 03 then 1 Else 0 End)
/count({internalid})
非常感谢任何指向我语法/逻辑错误的帮助。