Null Values Used in Calculated Properties

Hi y’all!

I’m working on a project that I’ve created a number of calculated properties for. In general, there are two types of contracts - hourly (billed by week) and monthly flat rate. Some deals have both types of contracts, so I’m solving for total contract value combining the value of both types of contracts. Here’s the basic idea:

projected total hourly value (hourly rate * weekly hours * length of contract)

+

projected total monthly value (rollup of total monthly rate of all vehicle contracts[custom object] * length of contract)

=

Projected Total Contract Value

However, whenever a deal doesn’t have both types of contracts (aka one of the properties in the calculation is null), the calculated properties evaluate to null.

I see two options:

1. update all my calculated properties with if statements that check whether the property has a value and if not use 0 instead.

2. make sure that the properties always have a value - meaning 0’s for any that don’t apply to the deal.

Anyone have any other ideas? Option one seems more reasonable but I figured someone here might have a better idea.

Thanks in advance!

Hey @JLittle2,

I think option 1 is the way to go too, or if you are fine with some of the initial calc properties having no value, just have the if statements in your last property (Projected Total Contract Value) where you can set the initial calc properties to 0 if they are empty.

Something like:

If(If(Is_known(projected total hourly value), projected total hourly value, 0), If(Is_known(projected total monthly value), projected total monthly value, 0)).

This is most likely wrong but with a little tweak you should be able to make it work :grinning_face_with_smiling_eyes:

Hope that helps,

Hi @JLittle2,

I would recommend going with option 1 as it is the more reliable one. By adding those if statements, you’re also ensuring that the outcome is not subject to potentially inconsistent input by users – who are not aware of the default behavior of calculation properties.

While you could create workflows that automatically add null values in empty fields, that means additional assets and potential follow-up issues. If statements are the cleanest way to go, in my opinion.

Best regards!