0

我正在 NetSuite 的 A/R Aging Saved Search 中构建一个公式。我已经使用以下公式成功查询了 30 天、60 天、90 天和 > 90 天:

Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) (condition based on days) then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) (condition based on days) then {amountremaining} else 0 end 

我们的 A/R 团队要求他们不希望总额中包含 > 90 天的任何贷记金额,因此我将 > 90 天的公式与另一个案例语句包装在一起,以排除小于 0 的值。我后来优化了公式对此:

Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 61 and 90 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 61 and 90 then {amountremaining} else 0 end

A/R 已请求进行额外更改,因为他们仍希望将所有贷记金额隔离为此已保存搜索的另一列。我尝试简单地切换上面公式的输出,但是在查询中仍然显示净债务的帐户上有贷记值:

╔════════════╦════════════╦══════════════════════╦═══════════════════╗
║    Name    ║ > 90 Days  ║ Credits in > 90 Days ║ Desireable Output ║
╠════════════╬════════════╬══════════════════════╬═══════════════════╣
║ Customer A ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer B ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer C ║ 4.95       ║ (4.95)               ║ No                ║
║ Customer D ║ 1,733.00   ║ 0.00                 ║ Yes               ║
║ Customer E ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer F ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer G ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer H ║ 10,547.96  ║ 0.00                 ║ Yes               ║
║ Customer I ║ 1.51       ║ (1.51)               ║ No                ║
║ Customer J ║ 0.00       ║ (21.92)              ║ Yes               ║
║ Customer K ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer L ║ 0.00       ║ 0.00                 ║ Yes               ║
║ Customer M ║ 0.00       ║ 0.00                 ║ Yes               ║
╚════════════╩════════════╩══════════════════════╩═══════════════════╝

我们不希望这些借记帐户包含在此特定列中。我曾多次尝试修改公式,但我觉得我遗漏了一些东西,我不确定如何从这里取得进展。

编辑:我想补充一下,我已经查看了显示不良输出的客户的个人记录。在我们的系统中有很多这样的案例,一些来自未申请的付款、贷记日记帐、备忘录等。有很多小众案例似乎受到了影响。我不确定尝试排除这些案例中的每一个是否是一种好方法,因为我不确定有多少案例以及从我正在查看的当前数据集中排除多少案例。我只想包括 >90 天列中的贷记金额,仅此而已。

4

1 回答 1

0

我发现贷记金额没有按我预期的方式隔离的原因是因为上述公式的性质:

Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) (condition based on days) then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) (condition based on days) then {amountremaining} else 0 end

该公式过滤掉负数和正数,以及一定天数之间或之后的金额。它们不考虑可能累积到超出预期值的 0 余额的值。

为了纠正这个问题,我对保存的搜索应用了一个额外的汇总条件,使用以下公式从结果中删除了总未结余额为 0 的条目:

(Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) < 1 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) < 1 then {amountremaining} else 0 end)+ (Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 1 and 30 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 1 and 30 then {amountremaining} else 0 end) + (Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 31 and 60 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 31 and 60 then {amountremaining} else 0 end) + (Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 61 and 90 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) between 61 and 90 then {amountremaining} else 0 end) + (Case When substr({amount},1,1) = '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) > 90 then ({amountremaining}*-1) When substr({amount},1,1) <> '-' and (NVL({daysoverdue}, Round({today}-{trandate}, 0))) > 90 then {amountremaining} else 0 end)

这删除了总未结余额为零或空的所有账户,这些账户原本不应该包含在此搜索中。

于 2020-02-13T21:54:33.703 回答