I have six fields in a table and I want to calculate a new field based on a formula using these six fields. Suppose the formula is simply:
newField = field1 + field2 + field3 + field4 + field5 + field6
how can I omit a field from this formula if the field value is 0? For example if for a row field1 = 0 then I want the new field to be calculated as:
newField = field2 + field3 + field4 + field5 + field6
Any field value can be 0 in any row. That field needs to be ommitted during calculation for that row. Multiple fields can also be 0, then all those fields are omitted. The fields cannot contain null values and are numeric. The formula needs to change conditionally based on the presence of 0 values. Is there anyway to do this with python or normally?
PS: Okay it looks like nothing needs to be changed in the above formula since adding 0 doesnt change anything. But its just an example. The actual formula is complex and if 0 value is used, the result will become false.