Data Hub

Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE

I am trying to use a calculated field, but if one of the values is empty in the calculation, then it returns a null value.

 

([properties.imported_total] + [properties.total_donations])

 

There has to be an easy way to fix this but chatgpt is telling me to use ops hub (which is fine) and use this formula in the format data step of the workflow: {{ properties.imported_total | default(0) }} + {{ properties.total_donations | default(0) }}

 

But that causes an error in the custom code step.  Please help

0 Upvotes
2 Accepted solutions
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops there's no special trick to this - just find the screenshot I shared in my earlier reply and type that exactly into the formula field, character by character 🙂

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops strange - can you save this and see if it populates correctly on records? It should work, see my screenshot. If it doesn't after refreshing, I'd recommend checking with HubSpot support.

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
11 Replies 11
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

Hi @Huntscape-Ops,

 

You can solve this with an 'if' statement and the 'is known' function, both available through drop downs in the formula editor - no Operations Hub required. If the number is known, return the number, if not, return a 0. Repeat the same for the second part of the calculation and that should do the trick.

 

karstenkoehler_0-1744049647724.png

 

Best regards

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE
Thank you for the quick reply but I am not advanced enough to do that. I
keep getting errors in the calculation

0 Upvotes
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops can you please share a screenshot? If you type the shown formula exactly, you shouldn't get any errors.

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE

This is my original calculation but it puts out null value when one of the fields is empty.  

HuntscapeOps_0-1744051735037.png

I have no idea how to adapt this to "if" and "is known" as you were describing. 

 

Any help would be greatly appreciated

0 Upvotes
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops there's no special trick to this - just find the screenshot I shared in my earlier reply and type that exactly into the formula field, character by character 🙂

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE
Wow that worked. I had 1 space off.

Thank you so much
0 Upvotes
Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE

I lied.  The formula no longer has errors but I am still getting null values in the calculated field

0 Upvotes
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops can you please share a screenshot and the error message? I can't help if I don't have any details.

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE

Does this help

 

HuntscapeOps_0-1744052623041.png

 

0 Upvotes
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Calculated fields return null values

SOLVE

@Huntscape-Ops strange - can you save this and see if it populates correctly on records? It should work, see my screenshot. If it doesn't after refreshing, I'd recommend checking with HubSpot support.

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
Huntscape-Ops
Contributor

Calculated fields return null values

SOLVE

I refreshed the screen and put the formula back in, and it is working now.

 

Thank you so much

0 Upvotes