# Custom code to count associated records.

**URL:** <https://community.hubspot.com/t/custom-code-to-count-associated-records/74501>\
**Category:** APIs & Integrations\
**Created:** [February 4, 2023, 11:45pm UTC](https://community.hubspot.com/t/custom-code-to-count-associated-records/74501 "2023-02-04T23:45:07Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![MSchallinger](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mschallinger/32/64711_2.png) [@MSchallinger](https://community.hubspot.com/u/MSchallinger)\
**Post date:** [August 14, 2024, 5:59pm UTC](https://community.hubspot.com/t/custom-code-to-count-associated-records/74501/4 "2024-08-14T17:59:04Z")

</div>

There’s a way to do this without “custom code”.

1. On the custom object, create a calculated property called “Power of One” (this is how I’ve heard it referenced elsewhere) that’s a custom equation and always equal to “1”.
2. On the company object, create a calculated property called “Number of Associated [custom object]” that’s a Count equation that counts up all the 1’s of the “Power of One” porperty.

 ![Power of One Property.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/1/e10b37fce9d97c5e331cd6078d27e15c2f40469f.png)

 ![Company Property Counting Number of Associated .png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/e/9e4cd73f4deead9ceebf0c124946238fbf6fe973.png)

---

_[View the full topic](https://community.hubspot.com/t/custom-code-to-count-associated-records/74501)._
