# Calculation Property

**URL:** <https://community.hubspot.com/t/calculation-property/133483>\
**Category:** CRM\
**Tags:** workaround, developer, crm\
**Created:** [May 28, 2025, 6:53am UTC](https://community.hubspot.com/t/calculation-property/133483 "2025-05-28T06:53:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marie9423498](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/marie9423498/32/96128_2.png) [@marie9423498](https://community.hubspot.com/u/marie9423498)\
**Post date:** [May 28, 2025, 6:53am UTC](https://community.hubspot.com/t/calculation-property/133483/1 "2025-05-28T06:53:12Z")

</div>

Hi,  
For context, we have specific rules we follow in attributing our contacts and deals. We base our deal attribution based on the outcome of a stamped value on the first associated contact on a deal.  
To keep it short we have a contact calculated property, once a deal is created and that contact is the first associated contact, we copy over the current value of the contact calculated property to a deal property that stores our attribution for that deal (i.e. Sales or Marketing).  
We now have to update our logic on the said contact calculated property and I don’t seem to make it work. Hoping a genius might find this thread and provide guidance.  
We want the logic to be  
IF Original Source is Organic Search, Organic Social, or Direact Traffic, then “Marketing”, if not will check  
IF time between Contact Create date and Deal Create Date \< 90 days,

check If Original Source is Offline, then “Sales”, else “Marketing”,  
if not check Marketing Score \> Sales Score, “Marketing”, “Sales”  
Sharing below the formula:  
if(  
([properties.hs\_analytics\_source] == “DIRECT” || [properties.hs\_analytics\_source] == “ORGANIC”),  
“Marketing”,  
if(  
time\_between([properties.createdate], [properties.lastmodifieddate]) \< 7776000000,  
if([properties.hs\_analytics\_source] == “OFFLINE”, “Sales”, “Marketing”),  
if(  
is\_known([properties.marketing\_attribution\_score]) && is\_known([properties.attribution\_test\_\_\_marketing]),  
if([properties.marketing\_attribution\_score] \>= [properties.attribution\_test\_\_\_marketing], “Marketing”, “Sales”),  
if(  
is\_known([properties.marketing\_attribution\_score]),  
“Marketing”,  
if(  
is\_known([properties.attribution\_test\_\_\_marketing]),  
“Sales”, “Marketing” )))))  
My problem is that if the time between Contact Create date and Deal Create Date \> 90 days,  
I could not seem to override the formula to always result to Marketing if Original Source is Direct or Organic, despite making it as the first rule/condition.  
Hoping for guidance from the community.  
Thank you.

---

<div class="post-metadata">

**Author:** ![Josh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/josh/32/17115_2.png) [@Josh](https://community.hubspot.com/u/Josh)\
**Post date:** [May 28, 2025, 2:20pm UTC](https://community.hubspot.com/t/calculation-property/133483/2 "2025-05-28T14:20:18Z")

</div>

Hi @marie9423498,

Thanks for providing the example and details up front. I think you’re pretty close, but I’ve run into similar quirks when trying to nest conditions like this, especially with calculated properties and HubSpot’s handling of source values.

The main issue sounds like it’s tied to how the formula is evaluating that first condition (I think). Even though you’ve placed the Direct/Organic check up top, the way the logic flows means it might still be falling through to the rest of the tree, especially if one of the dependent properties (like a score or timestamp) isn’t known.

Try this:

```lia-code-sample
if(
 [properties.hs_analytics_source] == "DIRECT" || 
 [properties.hs_analytics_source] == "ORGANIC_SEARCH" || 
 [properties.hs_analytics_source] == "ORGANIC_SOCIAL", 
 "Marketing", 
 if(
 time_between([properties.createdate], [properties.attribution_deal_create_date]) < 7776000000, 
 if(
 [properties.hs_analytics_source] == "OFFLINE", 
 "Sales", 
 "Marketing"
 ), 
 if(
 is_known([properties.marketing_attribution_score]) && is_known([properties.attribution_test___marketing]), 
 if(
 [properties.marketing_attribution_score] >= [properties.attribution_test___marketing], 
 "Marketing", 
 "Sales"
 ), 
 if(
 is_known([properties.marketing_attribution_score]), 
 "Marketing", 
 if(
 is_known([properties.attribution_test___marketing]), 
 "Sales", 
 "Marketing"
 )
 )
 )
 )
)

```

If this doesn’t work as intended, let me know and I’m happy to help troubleshoot further.

Josh

---

<div class="post-metadata">

**Author:** ![marie9423498](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/marie9423498/32/96128_2.png) [@marie9423498](https://community.hubspot.com/u/marie9423498)\
**Post date:** [May 30, 2025, 6:02am UTC](https://community.hubspot.com/t/calculation-property/133483/3 "2025-05-30T06:02:41Z")

</div>

Hi Josh,  
Thank you for coming to the rescue, truly appreciate it.  
I did tested the formula you suggested, however the 90 days logic still overrides even if the Original Source is Direct/Organic.  
Attached is the screenshot of the test. The scenario is even if the deal create date is more than 90 days of the contact create date, but since original source is “Organic Social”, the output should have been “Marketing”, but the formula still seems to refer to the greater score between Marketing Attribution Scorevs Sales Attribution Score.

 ![test-results.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/3/3ee8c7e2e7ed9e6ad77ea8b9c529bb21c1516650.png)

---

<div class="post-metadata">

**Author:** ![Josh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/josh/32/17115_2.png) [@Josh](https://community.hubspot.com/u/Josh)\
**Post date:** [May 30, 2025, 12:15pm UTC](https://community.hubspot.com/t/calculation-property/133483/4 "2025-05-30T12:15:25Z")

</div>

Hi @marie9423498,

Let’s try a couple of other things. It is a bit difficult to troubleshoot on my side because I don’t have the exact properties.

Can you check the internal property names of the sources- (these do need to match exactly)?

- ORGANIC\_SOCIAL might actually be SOCIAL\_MEDIA
- DIRECT should be DIRECT\_TRAFFIC
- Etc. - these do need to match exactly

If it still isn’t working I think we’ll want to break the formula down a into segments to see where it’s failing.

---

<div class="post-metadata">

**Author:** ![marie9423498](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/marie9423498/32/96128_2.png) [@marie9423498](https://community.hubspot.com/u/marie9423498)\
**Post date:** [June 2, 2025, 4:38am UTC](https://community.hubspot.com/t/calculation-property/133483/5 "2025-06-02T04:38:46Z")

</div>

Hi Josh,  
Truly appreciate for going through with me on this.  
This has solved the problem and the formula now works.  
Regards,

Marie
