# How to calculate values within a category for a period?

**URL:** https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018
**Category:** Ask for Help
**Created:** [February 21, 2024, 2:20pm UTC](https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018 "2024-02-21T14:20:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![d.shcherbakova](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d.shcherbakova/32/71226_2.png) [@d.shcherbakova](https://community.glideapps.com/u/d.shcherbakova)
#### Post date: [February 21, 2024, 2:20pm UTC](https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018/1 "2024-02-21T14:20:54Z")

</div>

I received monthly work hours for all categories. It is necessary to display the operating hours for a specific month for a particular category. What’s the best way to do this?

 ![glide_4](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/5/35465951e34f32f0f9ed2fb49ddd41bb06ba94d3.png)

 ![glide_3](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/e/1e42371b97b80163e7e43fb3ea191ea91e84f488.png)  
 ![glide_2](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/5/e56ff94d0b3f0cf86d8bb003acbe6ae151990d77.png)  
 ![glide_1](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/2/324f24f3491477173b6b6f79e01b61d8b4d8c923.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: [February 22, 2024, 2:15am UTC](https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018/2 "2024-02-22T02:15:58Z")

</div>

Do you have a table with a unique list of these categories?

---

<div class="post-metadata">

### Author: ![d.shcherbakova](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d.shcherbakova/32/71226_2.png) [@d.shcherbakova](https://community.glideapps.com/u/d.shcherbakova)
#### Post date: [February 22, 2024, 3:14pm UTC](https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018/3 "2024-02-22T15:14:04Z")

</div>

Hello, Robert\_Petitto  
thank you for your interest  
yes, I attached a screenshot.

 ![glide_3](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/e/1e42371b97b80163e7e43fb3ea191ea91e84f488.png)

---

<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: [February 23, 2024, 1:05am UTC](https://community.glideapps.com/t/how-to-calculate-values-within-a-category-for-a-period/71018/4 "2024-02-23T01:05:01Z")

</div>

I think you can approach it like this.

- In your Time Management table, create a math column with the formula:

YEAR(D)\*10^2+MONTH(D) with D being D\_Date.

I think this is much more reliable for all OS compared to what you seemingly do here (format date column I supposed).

- Create a query column targetting the same table, filter by category ID is the same as this row \> category ID and date value above equals to this row \> date value.

- Create a single value column targetting the query column above and return the first rowID that matches.

- Create a rollup column targetting the query column above and return the sum of all hours.

- Display a collection for the whole table, grouped by the month, filter by rowID equals the single value column, and the rollup for each item.
