# Roll Up and Average

**URL:** https://community.glideapps.com/t/roll-up-and-average/42885
**Category:** Ask for Help
**Created:** [June 9, 2022, 2:00pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885 "2022-06-09T14:00:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [June 9, 2022, 2:00pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885/1 "2022-06-09T14:00:16Z")

</div>

First - RollUp and row owners work great.

Interestingly I do a count and get 2 (correct), sum Revenue which is $50,000 (correct) and average Revenue which is $50,000 (incorrect).

However, one of the rows does not have a value for Revenue so technically it is correct, the average of the one row where Revenue is not empty is $50,000.

Is this how it should work? I was expecting count = 2, Revenue = $50,000, Average = $25,000

Thanks

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

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [June 9, 2022, 2:07pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885/2 "2022-06-09T14:07:14Z")

</div>

Answering my own question - It is how it works (I set Revenue to $0 and the average was correct).

I am not sure this is what everyone expects though.

Sum of Revenue/Count = Average is expected  
Sum of Revenue/(Count-\>Where revenue is not empty) = Average is not expected

For me it is simple to put a 0 into Revenue amount so it is not empty, but is this the expected behavior?

---

<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: [June 9, 2022, 2:21pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885/3 "2022-06-09T14:21:25Z")

</div>

Yes, I believe this is the expected behaviour. I guess whether or not it’s correct/desired behaviour is debatable.

What you could do is create an if-then-else column that returns zero if the revenue amount is empty, and then use this column in your rollups.

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [June 9, 2022, 2:39pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885/4 "2022-06-09T14:39:54Z")

</div>

Agree - as long as Glide documents the expected behavior it’s OK. Since I create the record it was oversight to not populate it with 0 to begin with.

---

<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: [June 10, 2022, 2:40pm UTC](https://community.glideapps.com/t/roll-up-and-average/42885/5 "2022-06-10T14:40:03Z")

</div>

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