# Counting/ Rollup Certain Values within a relation field

**URL:** <https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759>\
**Category:** Ask for Help\
**Created:** [December 15, 2022, 9:56am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759 "2022-12-15T09:56:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dempsey.daithi](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dempsey.daithi](https://community.glideapps.com/u/dempsey.daithi)\
**Post date:** [December 15, 2022, 9:56am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/1 "2022-12-15T09:56:57Z")

</div>

Hi Everyone!

I am currently working on a maintenance app for a manufacturer. One part of the app is that you can log maintenance call out to a machine, should it be down and need fixing. Each call out is is related to a machine and they each have their own dedicated table.

The question/ issue I am having is that I am wanting to create a roll up from the relation field based on the status of the call outs (Ongoing, On Hold, Completed) so that when you are viewing a machine within pages you can see a history/ breakdown of call outs in numbers for example 10 completed call outs, 1 on hold, 2 ongoing etc.

Hope I did a good enough job of explaining my issue! Thanks in advance for you help 🙂

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [December 15, 2022, 10:03am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/2 "2022-12-15T10:03:16Z")

</div>

each record of the call needs to have a machine row ID… then add an if-else column to filter out selected machine status, then other if-else columns to filter out any other info you need.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [December 15, 2022, 10:05am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/3 "2022-12-15T10:05:33Z")

</div>

> [@dempsey.daithi](#):
>
> Each call out is is related to a machine and they each have their own dedicated table.

This doesn’t sound right. You will probably be better off down the road if all call-outs are in one table, and all machines are in another.

---

<div class="post-metadata">

**Author:** ![dempsey.daithi](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dempsey.daithi](https://community.glideapps.com/u/dempsey.daithi)\
**Post date:** [December 15, 2022, 10:08am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/4 "2022-12-15T10:08:32Z")

</div>

Hi Nathan! I probably didn’t explain this well 😅 but yes, they are in separate tables, so one table for call outs and another table for all machinery

---

<div class="post-metadata">

**Author:** ![dempsey.daithi](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@dempsey.daithi](https://community.glideapps.com/u/dempsey.daithi)\
**Post date:** [December 15, 2022, 10:11am UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/5 "2022-12-15T10:11:36Z")

</div>

Hi Uzo! Thanks for your reply! How does using the Machine Row ID differ from using the name in the relation field? I have tried before using the if-else on the relation field to try and give me some values per status that can be rolled up, but I have had no luck 😕 is there any chance you could give me some more detail on how I could go about doing this more effectively? Thanks again!

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [December 15, 2022, 1:52pm UTC](https://community.glideapps.com/t/counting-rollup-certain-values-within-a-relation-field/55759/6 "2022-12-15T13:52:49Z")

</div>

Hola!

The trick here is create a template which joins the machine name (or ID) and its status in both tables and later, create a relation in order to use a Rollup.

but nothing better than a image…

1. You should have a data table like this

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/1/f1ad4b7c10eeb1fdc3625fcd3e67c9b6c6f15416.jpeg)

1. and I would have another table where all machines and their status are declared. Here is where we make the stats (what you want) and created the relation. Of course, all of this can be done dynamically by creating a screen and the user choosing the machine and state to search for.

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

I hope it helps you.

Saludos!
