# Summation of values in rows for specific row

**URL:** <https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502>\
**Category:** Ask for Help\
**Created:** [September 20, 2024, 6:24am UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502 "2024-09-20T06:24:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 20, 2024, 6:24am UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/1 "2024-09-20T06:24:17Z")

</div>

Hi  
I am making a food booking app where , different company staff add the item to the cart. Once every staff has added the item to cart , A company admin submit the order.

I am collecting all the orders by different companies in one sheet (mycart) . when company need to pay , i need to show SubTotal amount at that page. But i am unable to do sum for that specific company.

I tried , template, relation, roll up referring to the previous topics here but still could not succeed.  
Any help is appreciated.

 ![Screenshot 2024-09-20 at 08.19.10](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/e/de51b5698caad369180b1dac2535f30c649173c7.png)  
 ![Screenshot 2024-09-20 at 08.17.32](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/8/788a6da2b5db683db8e8b879230bc8c9ba1151f7.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 20, 2024, 6:28am UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/2 "2024-09-20T06:28:27Z")

</div>

- Create a relation column that matches the Company name with itself
- Do a Rollup-\>Sum-\>Price via that relation

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 22, 2024, 3:28pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/3 "2024-09-22T15:28:28Z")

</div>

Hi Darren  
Thanks. i got hang off it now. However i had one additional question. How can I do sum for different dates and different company .

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 22, 2024, 3:33pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/4 "2024-09-22T15:33:53Z")

</div>

It’s similar, except when you want to match multiple criteria you should use a Query column instead of a relation. Also, when working with dates in this way it’s best to first convert them to integers using a math column. So, to sum by Company and Date:

- Start with a Math column using the following formula:

```auto
Year(Date)*10^4
+Month(Date)*10^2
+Day(Date)

```

- Substitute “Date” in that formula with your Date column. That will give you an integer representation of the date in YYYYMMDD format
- Next create a Query column that targets your table and apply the following filters:  
– Company is This row-\>Company  
– (math) Date is This row-\>(math) Date
- Finally, do a rollup-\>sum via the Query

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 22, 2024, 3:51pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/5 "2024-09-22T15:51:19Z")

</div>

Hi Darren Thanks for quick reply.  
I implemented as you suggested but it did not sum for same company for same date. See attached picture. For company A it did not work. But for company B it did worked. Am i missing something.

 ![Screenshot 2024-09-22 at 17.47.32](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/4/c442e027874c828ac376d9a86cc38d7b06f0740c.jpeg)

---

<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:** [September 22, 2024, 4:00pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/6 "2024-09-22T16:00:52Z")

</div>

You skipped the step to convert your date into a YYYYMMDD integer. You need to consider that your date columns have an underlying time that differs on each row.

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 22, 2024, 4:03pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/7 "2024-09-22T16:03:09Z")

</div>

Hi Darren i found error, Its fine now.  
I used non math date column.  
I have additional question . How can i filter out duplicate values from the rollup column. Same date values for same company.

 ![Screenshot 2024-09-22 at 18.01.22](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/1/11e06a9a8e66d38574433c08a46417a0daf79abf.png)

---

<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:** [September 22, 2024, 9:47pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/8 "2024-09-22T21:47:10Z")

</div>

> [@Filter to display DISTINCT (or Unique) rows based on specified columns](https://community.glideapps.com/t/filter-to-display-distinct-or-unique-rows-based-on-specified-columns/70080/3):
>
> I typically use or recommend the following method: Make sure there is a Row ID column. Create a single Relation or Query to link similar rows to themselves based on similar values. Create a Lookup or Single Value column to retrieve the first matching Row ID from the Relation/Query. Finally create an IF column comparing the row’s Row ID to the Lookup/Single Value column and return true if there is a match. Only the first occurrence will be a match.

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 23, 2024, 4:45pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/9 "2024-09-23T16:45:25Z")

</div>

Hi Jeff  
I tried as per your suggestion above. However it does not single out same rows. It says true to all rows.

 ![Screenshot 2024-09-23 at 18.44.18](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/8/584959ad907bee1cd11c297c5e53c6ce8a43b120.jpeg)

---

<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:** [September 23, 2024, 5:01pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/10 "2024-09-23T17:01:48Z")

</div>

You already have a query column to handle the grouping. You should be using that and just adding a Single Value column to get the first RowID from each group.

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 23, 2024, 5:11pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/11 "2024-09-23T17:11:15Z")

</div>

Thanks Jeff  
It worked. I got them sorted. Now i need to figure out how to show them when user login and click them.  
It was good learning about relation, query so on.

---

<div class="post-metadata">

**Author:** ![prasad\_chougule](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/prasad_chougule/32/78953_2.png) [@prasad\_chougule](https://community.glideapps.com/u/prasad_chougule)\
**Post date:** [September 23, 2024, 5:15pm UTC](https://community.glideapps.com/t/summation-of-values-in-rows-for-specific-row/76502/12 "2024-09-23T17:15:15Z")

</div>

Thanks for your support. it’s so fulfilling when some things works and most importantly good quality support.
