MAX(CASE WHEN ({memo} LIKE '%Custom Charges%') THEN {amount} ELSE 0 END) +MAX(CASE WHEN ({memo} LIKE '%Demurrage charges%') THEN {amount} ELSE 0 END) +MAX(CASE WHEN ({memo} LIKE '%Packing charges') THEN {amount} ELSE 0 END) The abouve one formula calculates the sum of three landed cost categories. Then, the total value of an item, i.e., {amount}, is added to this sum. Finally, the entire result is divided by the quantity, i.e., {quantity}, to obtain the average cost per item. But I am not getting result for this simple calculation.Don't know why ?