case when SUM(case when {type} = 'Invoice' then {a...
# suitescript
m
case when SUM(case when {type} = 'Invoice' then {amount} when {type} = 'Sales Order' then (-1 * {amount}) else 0 end) > 0 then 'Great!' else 'Not Great!' end