# Need urgent help with calculation of quantities

**URL:** <https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555>\
**Category:** Ask for Help\
**Tags:** custom-code\
**Created:** [January 26, 2025, 7:17pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555 "2025-01-26T19:17:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadia\_Mehreen](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sadia_mehreen/32/71614_2.png) [@Sadia\_Mehreen](https://community.glideapps.com/u/Sadia_Mehreen)\
**Post date:** [January 26, 2025, 7:17pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555/1 "2025-01-26T19:17:40Z")

</div>

I have two tables: **Company** and **Products**. The **Products** table has a relation to the **Company** table. In the **Products** table, there’s a column that can store multiple product entries with their respective quantities, such as:

- Glass: 2
- Glass: 3
- Rubber: 4
- Rubber: 8
- Tile: 1

What I want is to calculate the total quantity for each unique product. For example, the output for the above data should be:

- Glass: 5
- Rubber: 12
- Tile: 1

How can I achieve this?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 26, 2025, 7:37pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555/2 "2025-01-26T19:37:47Z")

</div>

Create a relation linking the product to itself.  
Then rollup the relation.

---

<div class="post-metadata">

**Author:** ![Sadia\_Mehreen](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sadia_mehreen/32/71614_2.png) [@Sadia\_Mehreen](https://community.glideapps.com/u/Sadia_Mehreen)\
**Post date:** [January 26, 2025, 8:11pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555/3 "2025-01-26T20:11:46Z")

</div>

All the data is part of a single row, roll up gives a single value and I want rollups for the unique items, there will be 3 rollups in the above case

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 26, 2025, 8:27pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555/4 "2025-01-26T20:27:42Z")

</div>

Can you show how you are storing the data? Is it JSON?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 26, 2025, 11:58pm UTC](https://community.glideapps.com/t/need-urgent-help-with-calculation-of-quantities/79555/5 "2025-01-26T23:58:49Z")

</div>

And whether if it’s a JSON or just like what you described above, can you tell how it was input into that column?
