# Dynamic Sum based on other columns values

**URL:** <https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997>\
**Category:** Ask for Help\
**Created:** [November 21, 2023, 2:56pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997 "2023-11-21T14:56:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serge\_Galoup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/serge_galoup/32/66745_2.png) [@Serge\_Galoup](https://community.glideapps.com/u/Serge_Galoup)\
**Post date:** [November 21, 2023, 2:56pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/1 "2023-11-21T14:56:30Z")

</div>

Hi there,

I’m trying to get the rollup of a colum…but this rollup needs to changed based on criteria.  
It is kind of a Rollup combined with a SUMIF but I’m failing to do it so far…  
In excel, I would have use MATCH and INDEX to get there - any idea what would be the best way ?

Hopefully the below screen shot is self-explanatory : I want in column “PoidsCamion” to sum value of colum “Poids Net Big Bag” until the “Numéro Camion” changes (or until “Numéro Big bag” is back to 1 which is the same).

Any guidance would be much appreciated !!

(note : on the picture, I manually populated value in column “PoidsCamion” 😉 )

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/b/2b872ffd13078ce1cdc951657d4b80856bcf3836.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:** [November 21, 2023, 3:08pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/2 "2023-11-21T15:08:04Z")

</div>

- Create a Query column that targets the table, and use the following filter:  
– Numero Camion equals This row → Numero Camion
- Do your rollup-\>sum via that Query column

---

<div class="post-metadata">

**Author:** ![Serge\_Galoup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/serge_galoup/32/66745_2.png) [@Serge\_Galoup](https://community.glideapps.com/u/Serge_Galoup)\
**Post date:** [November 21, 2023, 3:16pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/3 "2023-11-21T15:16:38Z")

</div>

Wow ! Brillant !  
I would have never though about this 🙂

Thanks a lot, exactly what I was after !

---

<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:** [November 21, 2023, 3:18pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/4 "2023-11-21T15:18:38Z")

</div>

The Query column is incredibly powerful.  
If you’d asked the same question a year ago, the solution most likely would have involved a dozen or more computed columns 🙂

---

<div class="post-metadata">

**Author:** ![Serge\_Galoup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/serge_galoup/32/66745_2.png) [@Serge\_Galoup](https://community.glideapps.com/u/Serge_Galoup)\
**Post date:** [November 21, 2023, 3:21pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/5 "2023-11-21T15:21:45Z")

</div>

Good to know, I’ll look deeper in the documentation for this Query column then 😉

---

<div class="post-metadata">

**Author:** ![JackVaughan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jackvaughan/32/49023_2.png) [@JackVaughan](https://community.glideapps.com/u/JackVaughan)\
**Post date:** [November 21, 2023, 3:34pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/6 "2023-11-21T15:34:38Z")

</div>

This is great, I’m working on a video about QueryVSRelations - may include a similar example.

---

<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:** [November 21, 2023, 3:36pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/7 "2023-11-21T15:36:22Z")

</div>

> [@JackVaughan](#):
>
> I’m working on a video about QueryVSRelations

Well, isn’t that a happy coincidence 🤣

---

<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:** [November 21, 2023, 3:58pm UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/8 "2023-11-21T15:58:50Z")

</div>

If you are looking for examples, a very good argument for the Query column is the ability to conditionally check a range of dates. This was something that was next to impossible to do with a Relation. Imagine trying to find matching child records that have a date that falls in-between a start and end date on the parent record.

---

<div class="post-metadata">

**Author:** ![JackVaughan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jackvaughan/32/49023_2.png) [@JackVaughan](https://community.glideapps.com/u/JackVaughan)\
**Post date:** [November 23, 2023, 10:30am UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/9 "2023-11-23T10:30:17Z")

</div>

@Darren_Murphy 😜

@Jeff_Hager Nice! That’s awesome. Working on Query Column video today so will try to build that in.

Did the QueryVsRelation one yesterday. [https://www.youtube.com/watch?v=wa1OEGBG-3s](https://www.youtube.com/watch?v=wa1OEGBG-3s)

#tutorial

---

<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:** [November 30, 2023, 10:30am UTC](https://community.glideapps.com/t/dynamic-sum-based-on-other-columns-values/67997/10 "2023-11-30T10:30:46Z")

</div>

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