DECODE({accounttype}, ‘Expense’, (case when {creditamount} >0 then -1 else 1 end), ‘Other Expense’, (case when {creditamount} >0 then -1 else 1 end), ‘Cost of Goods Sold’, (case when {creditamount} >0 then -1 else 1 end), ‘Income’, (case when {debitamount} >0 then -1 else 1 end),’Other Income’, (case when {debitamount} >0 then -1 else 1 end),1)*{custcol_jj_amnt_usd}
or you can use the below
DECODE(
{accounttype},
‘Expense’, DECODE(SIGN({creditamount}), 1, -1, 1),
‘Other Expense’, DECODE(SIGN({creditamount}), 1, -1, 1),
‘Cost of Goods Sold’, DECODE(SIGN({creditamount}), 1, -1, 1),
‘Income’, DECODE(SIGN({debitamount}), 1, -1, 1),
‘Other Income’, DECODE(SIGN({debitamount}), 1, -1, 1),
1
) * {custcol_jj_amnt_usd}