Scenario:
The field with no value or the record/ form without the field has been eliminated while calculating the desired result.
Here within the formula the {item.custitem_aha_parent_class} field is applied to all items except discount item and there are items with no values in the field.
NVL(SUM(CASE WHEN {type} IN (‘Invoice’, ‘Credit Memo’) AND {item.custitem_aha_parent_class} <> ‘Labor’ THEN NVL({amount}, 0) ELSE 0 END), 0)
Solution:
The updated formula considers all items where it will include the forms/ item with no value and the one with field not applied.
NVL(SUM(CASE WHEN {type} IN (‘Invoice’, ‘Credit Memo’) AND (({item.custitem_aha_parent_class} IS NULL)OR({item.custitem_aha_parent_class}<>’Labor’)) THEN NVL({amount}, 0) ELSE 0 END), 0)