Formulas – CASE Statement
CASE WHEN {amount} > 0 THEN (({amount} - (CASE WHEN {item.type} =
'Inventory Item' THEN {item.lastpurchaseprice} * {quantity} WHEN {item.type}
= 'Kit/Package' THEN {item.custitem161} * {quantity} ELSE 0 END) - (CASE
WHEN {partner} = 'Amazon' THEN {amount} *0.25 WHEN {partner} =
'Webstore' THEN {amount} *0.05 WHEN {partner} = 'eBay' THEN {amount}
*0.20 WHEN {partner} = 'eBay AU' THEN {amount} *0.19 WHEN {partner} =
'eBay UK' THEN {amount} *0.18 WHEN {partner} = 'Newegg' THEN {amount}
*0.20 WHEN {partner} = 'Buy.com' THEN {amount} *0.30 WHEN {partner} =
'FBA' THEN {amount} *0.27 ELSE 0 END) - (CASE WHEN {partner} = 'FBA'
THEN {amount} *.12 ELSE (CASE WHEN {item.custitem201} IS NOT NULL
THEN {item.custitem201} * {quantity} ELSE 0 END) END) + (CASE WHEN
{amount} < 15 THEN {custbody_ca_shipping_cost} ELSE 0 END))/{amount})
ELSE 0 END
This is a formula to return the Gross Profit of a sale based on the sales channel.
This has CASE statements embedded within other CASE statements.
(Sale amount – Cost – Site Fee – Shipping Cost) / Amount = GP%