# Get Max of Each Category

**URL:** https://community.glideapps.com/t/get-max-of-each-category/67526
**Category:** Ask for Help
**Created:** [November 4, 2023, 6:32am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526 "2023-11-04T06:32:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![RyanThomas](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@RyanThomas](https://community.glideapps.com/u/RyanThomas)
#### Post date: [November 4, 2023, 6:32am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/1 "2023-11-04T06:32:16Z")

</div>

I am trying to make an app that will track truck and generator maintenance, logging mileage so that I can have a central place to check to see if a vehicle needs an oil change.

I already collect the mileage in another app, so I will have that data available to me.

Now I have a maintenance app where you will be able to log oil changes and other repairs. For now I only have a section for generators. Each generator has a specific barcode ID which is listed in the title.

 ![Screenshot 2023-11-03 at 11.27.16 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/b/cb771027b7e66aee9fb35e0b506113475d0e39ca.png)

If you click inside you can add oil changes and other repairs.

 ![Screenshot 2023-11-03 at 11.27.36 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/6/f6f873bfbe51ea2bf785abe37ebe1ac014a6b3a4.png)

For the generators they need an oil change every 100 hours of use or every 6 months.

Right now, I’m trying to figure out how to get the max hour count from this maintenance table and have it filter results to only show a specific generator.

I can’t figure out how to get the maximum hour counter . Anyone have any insight?

 ![Screenshot 2023-11-03 at 11.34.42 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b396fcb3bf48de6ea4ad741f7d791e8472068f06.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 4, 2023, 6:37am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/2 "2023-11-04T06:37:44Z")

</div>

Sounds like you need a Query column. If you can show me what your data tables look like I might be able to give you the exact configuration needed.

---

<div class="post-metadata">

### Author: ![RyanThomas](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@RyanThomas](https://community.glideapps.com/u/RyanThomas)
#### Post date: [November 4, 2023, 6:38am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/3 "2023-11-04T06:38:43Z")

</div>

I was playing with the Query field, had a feeling that might be it! I just edited my post, but here is the table for the generator maintenance.

I have a specific Row ID that corresponds with each generator.

 ![Screenshot 2023-11-03 at 11.34.42 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b396fcb3bf48de6ea4ad741f7d791e8472068f06.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 4, 2023, 6:41am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/4 "2023-11-04T06:41:07Z")

</div>

So the goal is to get the Hour count from the most recent oil change for each generator?

---

<div class="post-metadata">

### Author: ![RyanThomas](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@RyanThomas](https://community.glideapps.com/u/RyanThomas)
#### Post date: [November 4, 2023, 6:43am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/5 "2023-11-04T06:43:28Z")

</div>

That is correct.

---

<div class="post-metadata">

### Author: ![RyanThomas](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@RyanThomas](https://community.glideapps.com/u/RyanThomas)
#### Post date: [November 4, 2023, 6:47am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/6 "2023-11-04T06:47:09Z")

</div>

I think I have it figured out now…you definitely put me on the right track with Query…I think my hang up was not putting this query on the main table with each generator. I was trying to do it in the table with all the maintenance before that had each individual hour count.

I did this Query…

 ![Screenshot 2023-11-03 at 11.46.03 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/0/a059bea7577c501c88282a41cafee0718723e759.png)

And then this for the Rollup - Max column.

 ![Screenshot 2023-11-03 at 11.46.25 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/4/746f0bc61fc5145636b3e01dc3ddd1f7ccd40062.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 4, 2023, 6:53am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/7 "2023-11-04T06:53:31Z")

</div>

> [@RyanThomas](#):
>
> I think my hang up was not putting this query on the main table with each generator.

yep, that’s the key.  
I was going to suggest order by Date limit one and then use a Single Value. But what you have looks fine.  
You might want an extra filter in your Query (Service Done) if you will have other types of Service.

---

<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 11, 2023, 6:54am UTC](https://community.glideapps.com/t/get-max-of-each-category/67526/8 "2023-11-11T06:54:24Z")

</div>

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