## CMS Development

Participante | Partner

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hello,

Currently, we have the enterprise level HubSpot account and have been working on creating calculation properties to add together transactional pieces. There is a major roadblock with this property as it doesn't allow a calculation formula to run if there is a blank property. Is there any sort of workaround for this problem?

Thanks,

KP

Solución
HubSpot Employee

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi all,

I tested this with a customer today. Setting the properties included in the calculation property to 0 did work.

To configure this, you can:

• Create the calculated property using two number properties.

• On the contact record, add 0 for any values that are unknown.

When the value for Number property 2 is blank, the Calculated number property is unknown.

When the value for Number property 2 is 0, the Calculated number property is calculated.

I hope this helps! Please let me know if you have any questions!

Thanks,

Melinda | (She/Her)

Customer Support Specialist

Solución
Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

In case anyone stumbles upon this like I did - I also couldn't get this to work and instead used workflows to set the default property to 0.

22 Respuestas 22
Participante | Partner nivel Platinum

## Calculation Property Doesn't Work if a Property is Blank

resolver

Alternative solution without using a workflow: Use Advanced Mode in the Calculation Property and combine if and is_present function before adding the properties:

(if(is_present([properties.xy]), [properties.xy], 0) +

Miembro

## Calculation Property Doesn't Work if a Property is Blank

resolver

At first: big shame on Hubspot that the paying users have to find workarounds for problems like this - problems, that appeared already years ago.

At second: in my opinion the easiest solution is to use a workflow and the funktion

"Increase or decrease property" and increase the value by 0, because unknown + 0 = 0

Best,

Florian

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi @MHill4
Thanks for this workaround. Could you maybe share a screenshot of your solution? I cannot get it to work myself - if I multiply an unknown value times 1, I still get unknown, not 0...

---

Solución
Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

In case anyone stumbles upon this like I did - I also couldn't get this to work and instead used workflows to set the default property to 0.

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

Sorry, by Constant 1, I just meant the number 1.

In the calculation property A for example, your formula would be: (Property A x 1)

That way unknowns for Property A stay unknown, but you can still include those in calculations as 0.

So for @GiantVoices example above. You would make a new calculation property for each of the properties in the proposed formula. For example "2015 Q1 Payment Amount Calc," which would equal (2015 Q1 Payment Amount x 1).

For records with unknown 2015 Q1 Payment Amount, 2015 Q1 Payment Amount Calc = 0

For records with a number entered in 2015 Q1 Payment Amount, 2015 Q1Payment Amount = the same number.

does that help?

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi All,

I believe I may have found a solution to this issue. A bit of effort upfront, but it definitely works!

Lets say: Property A + Property B + Property C = Calculation Property X

For each of Property A, B and C, just create a new calculation property, maybe labeled "Property A Calc", where you do (Property A x Constant 1) = Property A Calc. If Property A is blank, the Property A Calc property will be 0. If Property A is known, Property A Calc = Property A.

So then to get Calculation Property X, you would just do Property A Calc + Property B Calc + Property C Calc. Then it runs perfectly! AND you don't need to do any workflows and you maintain the blank status of the original field which is important!

Participante | Partner nivel Gold

## Calculation Property Doesn't Work if a Property is Blank

resolver

Thank you MHill4,

What should be the value for Constant 1 in the formula or should I create a new porperty named Constant 1?
Thanks for clarifying.

Andres

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

I've built workflows that set the property to 0 if unkown but then the problem is if you have a calculation property that references another calculation, there's no way of getting the second calculation to work if all of the criteria are not met.  Pretty frustrating.

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi, Frank,

I'm running into this exact issue now - Is there a best practice to set multiple default values to zero in a single workflow, or did you have to create multiple workflows to set multiple default values?

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

The simplest way I have found to do this is as follows:

• First we want to check the value to see if there is anything entered in there. Hence "less than or equal to \$0 or EMPTY".
• If value is empty, then set the property to be 0.
• If value is not empty or is greater than \$0 then "go to action"

• This second action is repeating the same steps as above on the next value that needs to be checked.

I do like the method above using calculated values but if you are not on an enterprise account then you need to use your 5 calulated fields sparingly.

Solución
HubSpot Employee

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi all,

I tested this with a customer today. Setting the properties included in the calculation property to 0 did work.

To configure this, you can:

• Create the calculated property using two number properties.

• On the contact record, add 0 for any values that are unknown.

When the value for Number property 2 is blank, the Calculated number property is unknown.

When the value for Number property 2 is 0, the Calculated number property is calculated.

I hope this helps! Please let me know if you have any questions!

Thanks,

Melinda | (She/Her)

Customer Support Specialist

Miembro

## Calculation Property Doesn't Work if a Property is Blank

resolver

Where can I configure this?

• On the contact record, add 0 for any values that are unknown.
Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

I'm not sure how this solution would help if the calculation property is calculating "Time Between". How do you put in a 0 value for a date? And even if there's a way, what about in an example where you're trying to calculate how long a deal has been in each stage for? If the deal is still in that stage you don't want a date set for it yet, but it's still a running count which isn't even being counted.

Líder intelectual

## Calculation Property Doesn't Work if a Property is Blank

resolver

Just want to add a workflow to make sure that all blank properties used in calcuated property formulas are auto-updated to zero as new contacts/objects are added to the CRM. 🙂

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

Hope that helps.

Be well,
Frank

www.mfrankjohnson.com
Miembro

## Calculation Property Doesn't Work if a Property is Blank

resolver

I also encountered the same case
I think Hubspot should add one condition when setting up fields with the following numeric format: if the field has no value, there are two options for users to choose to be blank or zero.
so the calculated fields will work

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

Any updates on this? I just ran into the same challenge and I'm hoping someone has a work around.  Thanks.

Participante | Partner

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hello Steve,

Unfortunately, I've reached out to many HubSpot Support team members and they were unable to provide an acceptable solution.

It's disappointing. However, my team is continually testing within the platform and will let you know if we can find an acceptable solution.

Participante

## Calculation Property Doesn't Work if a Property is Blank

resolver

I agree with this entirely - except, I'd add another bigger issue.

The proposed solution of setting the input properties to 0 if blank doesn't work.

It seems that calculated properties treat "0" and "unknown" as the same thing. This is crazy for a tool that is supposed to allow you to add and multiply values - sometimes it's important that you can add "0".

Case in point - we use calculated properties to track costs relating to a project. Our costs are input in various categories. We use a calculated property to add these up.

The issue - We dont always have costs in all the categories, so naturally we input "0".

The consequence of this is that the calculated property "total costs" does not add up!

If there's a reason for this I dont understand it?

Why not give us some control over this?

E.G.

- Calculate if any of the input values are known

- Calculate if all of the input values are known

- Treat unknown numbers as "0" or some other integer?

Etc?

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hi KP,

I've ran into similar issues (mostly with IE not handling calc well in some cases) and what I did was add a first "default" declaration in the CSS with the calc afterwards. If the calc isn't working it should apply the previous CSS declaration. Like:

```.your-selector {
height: 100px;
height: calc( {{ value }} * 3 );
}```

If the calc height value isn't working it should default to 100px above.

In my case it's getting the opacity from the colour picker:

```    .sog_team-member .sog_team-member-content {
rgba({{ module.default_image_overlay_colour_1.color|convert_rgb }}, 0.6),
rgba({{ module.default_image_overlay_colour_2.color|convert_rgb }}, 0.6)
); /* IE has trouble with nested calculations - defaulting to 0.6 */
rgba({{ module.default_image_overlay_colour_1.color|convert_rgb }}, calc({{ module.default_image_overlay_colour_1.opacity }} / 100)),
rgba({{ module.default_image_overlay_colour_2.color|convert_rgb }}, calc({{ module.default_image_overlay_colour_2.opacity }} / 100))
);
}```

In the first "background" above it uses an rgba value with an opacity of 0.6 and in the second it calculates that opacity based on what the user selected in the colour picker.

I hope that helps!

Stephanie O'Gay Garcia

HubSpot Design / Development

If this helped, please mark it as the solution to your question, thanks!

Stephanie O'Gay Garcia

Freelance HubSpot CMS Developer

Participante | Partner

## Calculation Property Doesn't Work if a Property is Blank

resolver

Hello Stephanie,

Although this a great solution, I don't believe it solves the issue with the "Calculation" property and the inability to complete the equation if there is a blank property. Below is one of the more basic equations we're looking to compute across all companies.