# Calculating percentages based on items in category

**URL:** https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902
**Category:** Ask for Help
**Created:** [April 12, 2020, 11:12pm UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902 "2020-04-12T23:12:25Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![dvdbsh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dvdbsh/32/404_2.png) [@dvdbsh](https://community.glideapps.com/u/dvdbsh)
#### Post date: [April 12, 2020, 11:12pm UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/1 "2020-04-12T23:12:25Z")

</div>

So I’m trying to make a task app that contains tasks and categories for those tasks.

I want to be able to use the progress bar component in my app to show how many apps in a certain category are completed, but for some reason I’m confused on how to go about this.

I’ve created a relation to sort which tasks are in which category, and I have a true/false column in my sheet that shows if the task is completed. I’m just a bit confused as to how to pull all of this together to use the component I want.

Sorry if this is such a basic question, but thanks for reading and taking the time to help me 🙂

---

<div class="post-metadata">

### Author: ![Wiz.Wazeer](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wiz.wazeer/32/72423_2.png) [@Wiz.Wazeer](https://community.glideapps.com/u/Wiz.Wazeer)
#### Post date: [April 13, 2020, 1:58am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/2 "2020-04-13T01:58:28Z")

</div>

While you are waiting for one of the experts to answer your query, you might find the following useful.

[https://docs.glideapps.com/all/reference/components/charts/progress-bar](https://docs.glideapps.com/all/reference/components/charts/progress-bar)

---

<div class="post-metadata">

### Author: ![Wiz.Wazeer](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wiz.wazeer/32/72423_2.png) [@Wiz.Wazeer](https://community.glideapps.com/u/Wiz.Wazeer)
#### Post date: [April 13, 2020, 2:37am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/3 "2020-04-13T02:37:02Z")

</div>

I’ve added a progress bar that auto-populates itself on completion of each task to a Glide app. It’s quite easy. Just use the Data editor to do it.

> **[Cleaning Checklist](https://autopopulateprobar.glideapp.io/)**
>
> Create checklists for your routines.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [April 13, 2020, 3:37am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/4 "2020-04-13T03:37:51Z")

</div>

What exactly is the problem you are having? I’m guessing part of it might be the dynamic nature of your lists, but having to set a specific range. To deal with that you would be best off setting the max range of the progress bar to 100 and calculating the percentage of completed tasks.

> [@Dynamic Min/Max for Progress Bar](https://community.glideapps.com/t/dynamic-min-max-for-progress-bar/484):
>
> In addition to setting the Minimum and Maximum within the builder, I’d like to suggest the ability to also set the minimum and maximum using sheet columns. I’m working on a project where I list containers with different capacities and the level that they are filled. For now I can and will calculate a percentage and use 0-100 for the range.

To get your values, I would first create a template column in your tasks sheet of the category and the checkbox value. In the Category sheet, create a template column of the category and the word ‘true’. Then in the category sheet, create a relation to link the category to the category in the task sheet. Create a rollup count using the relation to get the total number of tasks in that category. Next create a second relation using linking the template columns in both sheets. Create a rollup count using this relation to get the total number of tasks that have been completed. Now create a math column that takes the completed task count, divides it by the total task count, then multiplies by 100. This will be the percent complete out of 100.

---

<div class="post-metadata">

### Author: ![dvdbsh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dvdbsh/32/404_2.png) [@dvdbsh](https://community.glideapps.com/u/dvdbsh)
#### Post date: [April 13, 2020, 8:16am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/5 "2020-04-13T08:16:11Z")

</div>

Thanks so much for taking the time to type out your response! I’m sure it’s me and not you, but I wasn’t able to follow along with the steps outlined here.

> To get your values, I would first create a template column in your tasks sheet of the category and the checkbox value. In the Category sheet, create a template column of the category and the word ‘true’. Then in the category sheet, create a relation to link the category to the category in the task sheet. Create a rollup count using the relation to get the total number of tasks in that category

Okay, I believe I did this correctly, this is what it looks like:

 ![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/08bc312ce15dfe6a2e82bb2b54e92b8be1838130.png)  
 ![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/9/9892df3c9919a940cdc766781f5b8a965ee9e501.png)

> Next create a second relation using linking the template columns in both sheets. Create a rollup count using this relation to get the total number of tasks that have been completed.

This is where you lose me, I’m sorry.  
[xtqig.glideapp.io](http://xtqig.glideapp.io)

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [April 15, 2020, 2:26am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/6 "2020-04-15T02:26:24Z")

</div>

I’m assuming you are referring to this, which looks like you already solved your problem?

> [@Task At Hand App](https://community.glideapps.com/t/task-at-hand-app/7052):
>
> After some trial and error and some help from @Jeff_Hager, I was able to put together a little task management app! [Task at Hand app](http://taskathandapp.glideapp.io) This was my first foray into really playing around with the data editor. I’m sure I have some useless formulas here and there, but over all, I’m pretty proud of what came out of it! What do you think?

---

<div class="post-metadata">

### Author: ![dvdbsh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dvdbsh/32/404_2.png) [@dvdbsh](https://community.glideapps.com/u/dvdbsh)
#### Post date: [April 15, 2020, 2:28am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/7 "2020-04-15T02:28:27Z")

</div>

Yessir! thanks for the walk through!

---

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [July 8, 2020, 9:46pm UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/8 "2020-07-08T21:46:05Z")

</div>

Hi @Jeff_Hager, on the basis of your approach, I’m trying to build a simple dashboard (fully in the dataeditor since based upon data calculated in it, ie. not synchronised). I struggling because I want to sum some points (vs counting “true = 1” in the case above).

I have 2 sheets:

- challenges: multiple challenges per category, with ‘points won’ per challenges (3 types of level of points : 10, 5, 0)
- dashboard with categories: this is where I want to and “sum” values to collect per category

I made a relation between both sheets (cf. “subjectMacro” = category), then tried a lookup but I don’t see how to use the results.

I am thinking about a 3 if-then-else in the “challenges” sheet to identify the nb of points “10”, then “5”, then “0” ; then count each if-then-else, then multiply by the pointsvalue in the Dashboard sheet… But is there something less heavy?

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/040f115a0a1751fbca1d534bbf8f593dfbc1185a.png)

Many thanks if you have an idea!

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [July 20, 2020, 11:04pm UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/9 "2020-07-20T23:04:37Z")

</div>

Have you tried to create a Rollup column against the relation to sum the points?

---

<div class="post-metadata">

### Author: ![izumiinoue](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izumiinoue/32/79768_2.png) [@izumiinoue](https://community.glideapps.com/u/izumiinoue)
#### Post date: [September 24, 2024, 4:53am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/10 "2024-09-24T04:53:19Z")

</div>

How did you handle the second half of the problem; counting the number of completed task by category?

---

<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: [September 24, 2024, 2:46pm UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/11 "2024-09-24T14:46:01Z")

</div>

If you use a boolean to determine whether the task is completed or not, you can use a rollup over your relation from category to task, and count the “true” entries.

---

<div class="post-metadata">

### Author: ![izumiinoue](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izumiinoue/32/79768_2.png) [@izumiinoue](https://community.glideapps.com/u/izumiinoue)
#### Post date: [October 3, 2024, 4:12am UTC](https://community.glideapps.com/t/calculating-percentages-based-on-items-in-category/6902/12 "2024-10-03T04:12:43Z")

</div>

Thanks Thinh, I have a follow up question.

I’ve since added a filter to my collection to only show relevant tasks based on the user type (Muslim or Non-Muslim or both) by matching the **Applicable** column in **Checklist** table with **User Profile \> Mode**.

 ![Screenshot 2024-10-03 at 11.58.57 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/9/397ede6f1fc7871738d0a434c25e955410445fa1.jpeg)  
^ The tasks on Checklist table.

 ![Screenshot 2024-10-03 at 12.05.37 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/7/a7527d8d3d40a470bbf0586d2f3ab86487fad8ab.jpeg)  
^ The mode on **Users** table.

This means that both types of users will see a different number of total tasks. How do I reflect that in my **Progress** table?

 ![Screenshot 2024-10-03 at 11.56.20 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/2/323a12e2f85a1d2e49e6c5180370c8c187ff1fd5.jpeg)  
^ My current setup on **Progress** table to count number of total tasks; Relation to Category + Rollup.
