# Conditional Rollup

**URL:** <https://community.glideapps.com/t/conditional-rollup/36560>\
**Category:** Ask for Help\
**Created:** [January 1, 2022, 2:36pm UTC](https://community.glideapps.com/t/conditional-rollup/36560 "2022-01-01T14:36:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dolapo\_Amusan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dolapo_amusan/32/16764_2.png) [@Dolapo\_Amusan](https://community.glideapps.com/u/Dolapo_Amusan)\
**Post date:** [January 1, 2022, 2:36pm UTC](https://community.glideapps.com/t/conditional-rollup/36560/1 "2022-01-01T14:36:14Z")

</div>

Happy new year Gliders!

I have seen some answers about conditional rollups, but I strongly believe it should be a feature request.Looking at this table I have, I wish to easily do a count of **how many times my lookup returned the value “0”** for example.

Pending (if and) when it is a feature, what is the workaround to get this data?

 ![Screenshot 2022-01-01 at 15.33.21](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/2/2209dca2dd2d58d4aafda571597d3cd2f19c5674.png)

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 1, 2022, 3:20pm UTC](https://community.glideapps.com/t/conditional-rollup/36560/2 "2022-01-01T15:20:48Z")

</div>

Any time you want a conditional relation/Rollup, create the condition first with an ITE column.

If [COLUMN] = 0 then 1 (or TRUE) else 0 or empty (or FALSE)

Then Rollup by doing a sum of 1s (or a count of trues)

---

<div class="post-metadata">

**Author:** ![ShantanuIyengar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/shantanuiyengar/32/35546_2.png) [@ShantanuIyengar](https://community.glideapps.com/u/ShantanuIyengar)\
**Post date:** [January 1, 2022, 4:06pm UTC](https://community.glideapps.com/t/conditional-rollup/36560/3 "2022-01-01T16:06:13Z")

</div>

Same logic for sum as well!  
If the condition is True  
Then use the value or else use 0  
And then you can sum it all up!

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 1, 2022, 4:30pm UTC](https://community.glideapps.com/t/conditional-rollup/36560/4 "2022-01-01T16:30:32Z")

</div>

Right. A native conditional relation has been requested many times here on the forum, but until it happens, it requires the use of a combination of Glide columns.

Upvote:

> [@Conditional Relations](https://community.glideapps.com/t/conditional-relations/13818):
>
> I know myself and others have made this case before, but I’d like to mention it again. I think it would be hugely benificial to be able to apply IF conditions within Relation settings. My use case for this is to get the unpaid dollar amount from unpaid invoices. I have invoices for students that, let’s say, are billed monthly. The user creates the billing period for a particular month, and any lessons that have occured within that billing period are automatically included in that invoice. In…

---

<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 2, 2022, 3:55am UTC](https://community.glideapps.com/t/conditional-rollup/36560/5 "2022-01-02T03:55:25Z")

</div>

If you want a one-column solution then I have this experimental code to help.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/9/f9ce9df7b0c15ad65a3e20de1b1f1f620dca4824.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/a/8a7445a58fd833f0d644f26b4effa7de813aaaa1.png)

The link is:

`https://thinhdinhlca.github.io/count-occurrences-in-array/`

---

<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:** [January 3, 2022, 3:55am UTC](https://community.glideapps.com/t/conditional-rollup/36560/6 "2022-01-03T03:55:48Z")

</div>

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