# Add (sum) column value with multiple condition

**URL:** <https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833>\
**Category:** Ask for Help\
**Created:** [August 24, 2024, 9:45am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833 "2024-08-24T09:45:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zoli](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zoli/32/78396_2.png) [@Zoli](https://community.glideapps.com/u/Zoli)\
**Post date:** [August 24, 2024, 9:45am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/1 "2024-08-24T09:45:29Z")

</div>

Hi,

I’m struggling with this for a while now.  
I’d like to create sumifs with relation and rollup, but I can’t set it up properly.  
Here is my table:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/9/a9ba87e8237063e63502aa017e810c0e405f5f31.png)  
I’d like to sum the values in “Total P1” with the condition if “Kiválasztott Event” and “EV\_P1” match. So for example if Prága and Zoli then 1700.

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [August 24, 2024, 9:50am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/2 "2024-08-24T09:50:19Z")

</div>

Hi zoli, You can can create a template column combining Kiválasztott Event and EV\_P1. Then you will have a primary key you can rely on. Just create a relation towards that template column and roll it up. You will have a sumifs.

---

<div class="post-metadata">

**Author:** ![Zoli](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zoli/32/78396_2.png) [@Zoli](https://community.glideapps.com/u/Zoli)\
**Post date:** [August 24, 2024, 10:02am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/3 "2024-08-24T10:02:46Z")

</div>

Hi Marc-Olivier,

thanks, I could make it, it looks like this:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/c/0c067e71f7f4a14585dda8cfadd84f52a1622240.png)

What else do I need to do to have this information on the layout screen in a simple form. I’ve created a summary page where I’d like to summarize the results but it looks like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/5/053617f1d9073f22497a108628b5cb65875f4798.png)

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [August 24, 2024, 10:07am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/4 "2024-08-24T10:07:57Z")

</div>

As I wrote before, you have to create a column combining something like Praga-Zoli (combination of Praga and Zoli) in the same table. You need then to create a self relation to that column and roll it up.

---

<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:** [August 24, 2024, 2:57pm UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/5 "2024-08-24T14:57:04Z")

</div>

An alternative is using the query column.

> **[Query Column | Glide Docs](https://www.glideapps.com/docs/query-column)**
>
> Create complex relations in your data with conditional filtering, sorting, and limits.

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [August 24, 2024, 3:53pm UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/6 "2024-08-24T15:53:13Z")

</div>

Yes but I always ask myself why Glide says not to use Query column for this kind of process but it works great too.

---

<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:** [August 24, 2024, 11:01pm UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/7 "2024-08-24T23:01:06Z")

</div>

I have seen the query column be much slower than a relation column in certain cases, especially when a query needs to run on thousands of rows. But you could also argue that additional split text and/or template columns also add additional overhead before a relation can run.

If at all possible, I will try to avoid involving computed columns on either side of a relation or query because every computed columns needs to process before a relation can process. Next I will evaluate if using extra computed columns along with a relation is any better performance-wise over a query column on its own. Finally, I will 100% use a query column over a relation if there is no reasonable way to achieve the same thing with a relation (ex. date ranges).

For the most part, if I need to match up more than one set of columns, then I will use a query. If I’m only matching up one set of columns, then I use a relation. If using a query affects performance, I will at least try doing the same thing with a relation to see which one is better.

Don’t rule out Query completely. It has it’s uses.

---

<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:** [August 25, 2024, 1:08am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/8 "2024-08-25T01:08:05Z")

</div>

> [@Jeff\_Hager](#):
>
> If at all possible, I will try to avoid involving computed columns on either side of a relation or query because every computed columns needs to process before a relation can process. Next I will evaluate if using extra computed columns along with a relation is any better performance-wise over a query column on its own. Finally, I will 100% use a query column over a relation if there is no reasonable way to achieve the same thing with a relation (ex. date ranges).
> 
> For the most part, if I need to match up more than one set of columns, then I will use a query. If I’m only matching up one set of columns, then I use a relation. If using a query affects performance, I will at least try doing the same thing with a relation to see which one is better.

I share this take. Also it makes things easier to evaluate now that you can evaluate how long a column takes to calculate.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/b/4bf43f6baadaffd4f49d75e60cb4918bc607a49d.png)

---

<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 25, 2024, 3:27am UTC](https://community.glideapps.com/t/add-sum-column-value-with-multiple-condition/75833/9 "2024-08-25T03:27:53Z")

</div>

Me three.

Analyze Performance is documented now:

[https://www.glideapps.com/docs/reference/account/performance-analysis](https://www.glideapps.com/docs/reference/account/performance-analysis)

I’ve tried it a couple of times on one of my more complex Apps, but it just melts my web browser 🫠
