# How to sum up multi-criteria

**URL:** <https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108>\
**Category:** Ask for Help\
**Created:** [August 30, 2022, 6:29am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108 "2022-08-30T06:29:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![paiboolk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paiboolk/32/86903_2.png) [@paiboolk](https://community.glideapps.com/u/paiboolk)\
**Post date:** [August 30, 2022, 6:29am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/1 "2022-08-30T06:29:13Z")

</div>

![1661840313627](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/e/9ec16e70cbf3af145886f35f47fd92a63ae213bf.jpeg)  
I have transaction looks like above picture and would like to sum up and display as below picture.  
 ![1661840313617](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/c/ec70e3c2eb1c7977857ff3840b1324a068510938.jpeg)

How to do that?

---

<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:** [August 30, 2022, 6:43am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/2 "2022-08-30T06:43:54Z")

</div>

- Create a template column that joins the Item & Location
- Create a multiple relation that matches that template column to itself
- Add two rollup columns that take a sum through that relation; one for Qty In and one for Qty Out

 ![Screen Shot 2022-08-30 at 2.41.46 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/5/e5042fa0088707178426022b597f70348262b1e6.jpeg)

---

<div class="post-metadata">

**Author:** ![paiboolk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paiboolk/32/86903_2.png) [@paiboolk](https://community.glideapps.com/u/paiboolk)\
**Post date:** [August 30, 2022, 7:33am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/3 "2022-08-30T07:33:39Z")

</div>

Thank you @Darren_Murphy . It works. Anyway, it missed the third step to add lookup value from that relation.  
Anyway, I still don’t get the idea why to create a multiple relation to match itself?

---

<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:** [August 30, 2022, 8:08am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/4 "2022-08-30T08:08:02Z")

</div>

What would you want a Lookup for?  
A lookup will only give you the associated value with the first of each set, which I assumed is not what you want?  
Matching each set to itself allows the rollups to give the correct result.

Edit: Actually, the result of a lookup would depend on whether the relation is single or multiple. A lookup through a single relation would give you the first value, a lookup through a multiple relation would give you an array of all values. Either way, it’s not what you need.

---

<div class="post-metadata">

**Author:** ![paiboolk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paiboolk/32/86903_2.png) [@paiboolk](https://community.glideapps.com/u/paiboolk)\
**Post date:** [August 30, 2022, 8:15am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/5 "2022-08-30T08:15:17Z")

</div>

Relation cannot roll up number. Hence, I have to use lookup after relation every time. Is it right? I am not sure.

---

<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:** [August 30, 2022, 8:22am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/6 "2022-08-30T08:22:16Z")

</div>

No, you don’t need any Lookups.  
Just make sure your relation is a multiple relation, and then use two rollup columns.  
One for Qty In, and one for Qty Out.  
Like this:

 ![Screen Shot 2022-08-30 at 4.20.30 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/3/c3a84fd54d94ba32f2eb94c8e6357842d10f1739.png)

 ![Screen Shot 2022-08-30 at 4.20.58 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/c/ac9a9b6b61dc4d59fcbac9d8b189576c7f5bed91.png)

---

<div class="post-metadata">

**Author:** ![paiboolk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paiboolk/32/86903_2.png) [@paiboolk](https://community.glideapps.com/u/paiboolk)\
**Post date:** [August 31, 2022, 12:59am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/7 "2022-08-31T00:59:44Z")

</div>

![1661907313188](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/b/5bb8d969b96950d4bea4de9ae06f81637960908e.jpeg)

Dear @Darren_Murphy ,  
The solution you advice me works very well. Thank you so much.  
I face a new problem. After display on the table, some records are have the same matched item as in attached picture. How to screen them out?

---

<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:** [August 31, 2022, 5:22am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/8 "2022-08-31T05:22:34Z")

</div>

- Add a RowID column to the table (if you don’t already have one)
- Add a Single Value column. This should fetch the first RowID via the multiple relation that you created earlier
- Now add an if-then-else column:  
– If RowID is Single Value RowID, then true

Use that if-then-else column as a filter - “where if-then-else is checked”

---

<div class="post-metadata">

**Author:** ![paiboolk](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paiboolk/32/86903_2.png) [@paiboolk](https://community.glideapps.com/u/paiboolk)\
**Post date:** [August 31, 2022, 6:45am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/9 "2022-08-31T06:45:15Z")

</div>

Thank you. It works.

🙂

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [September 1, 2022, 6:46am UTC](https://community.glideapps.com/t/how-to-sum-up-multi-criteria/48108/10 "2022-09-01T06:46:11Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
