1

我在 NetSuite 中创建了一个保存的搜索,其中显示了两个单独的案例语句。

1- {transaction.type} = 'Item Receipt' and {transaction.account} = '5505 Cost of Goods Sold : Product Cost' 或 {transaction.type} = 'Item Fulfillment' and {transaction.account} = ' 5505 已售商品成本:产品成本'然后 {transaction.amount} else null end

2- 当 {transaction.type} = 'Invoice' 或 {transaction.type} = 'Cash Sale' 或 {transaction.type} = 'Cash Refund' 或 {transaction.type} = 'Credit Memo' 然后 {transaction.金额}否则为空结束

现在我需要添加第三列,在其中我可以通过在 case case 语句 1 和 2 之间划分结果值来显示 %。任何建议这怎么可能?谢谢!

4

1 回答 1

1

正如布赖恩提到的(我想你正在做的)分组是最简单的方法。

NetSuite 搜索示例

您可以对公式(百分比)字段使用最小值(如图所示)、最大值或平均值。

上面显示的 IN 语句也将简化您的公式。

编辑:

为避免可能的除以零错误:

SUM(当 {transaction.account} = '5505 已售商品成本:产品成本'和 {transaction.type} in ('Item Fulfillment','Item Receipt') then {transaction.amount} else 0 end) / NULLIF ( SUM(当 {transaction.type} in ('Invoice','Cash Sale','Cash Refund','Credit Memo') then {transaction.amount} else 0 end) ,0)

于 2019-11-05T17:26:42.840 回答