# Vertical ratio on a table

**URL:** <https://community.glideapps.com/t/vertical-ratio-on-a-table/62419>\
**Category:** Ask for Help\
**Created:** [June 3, 2023, 5:27pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419 "2023-06-03T17:27:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://community.glideapps.com/u/Pascal)\
**Post date:** [June 3, 2023, 5:27pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/1 "2023-06-03T17:27:32Z")

</div>

Hello,  
I am brand new to Glide, sorry the answer to my question is obvious.

Let us say that I have a table containing products with their sale amount  
I want to display a table with the list of products, amount of sales for each product and the share of each product on total sales.  
I cannot find a way to calculate this share (Product.Sales / Total sales), knowing that the total of sales depends on the filter applied on the table, meaning that it cannot be pre-computed.

can anyone help?

Thank you

Pascal

---

<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 3, 2023, 5:37pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/2 "2023-06-03T17:37:04Z")

</div>

I’ll assume that you have one table that has a list of all of your Products, and another table that has a list of all of your Sales, and the Sales table includes columns for both Product and Sale Price.

To get a total of all Sales, create a rollup column in your Products table. This should take a sum of the price from your Sales table.

To get a total for each Product, first add a multiple relation column to your Products table. This should match the Product name with the Product name in your Sales table. Then add a rollup column that takes a sum of Price via the multiple relation column.

Finally, to calculate the percentage share of each product of total sales, use a math column with the formula:

```auto
(Product Total / Total) * 100

```

Replace Product Total with the second rollup column, and replace Total with the first rollup column.

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://community.glideapps.com/u/Pascal)\
**Post date:** [June 3, 2023, 6:07pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/3 "2023-06-03T18:07:43Z")

</div>

Hi Darren,  
Thank you for your answer, I think I was not clear enough.  
Let us forget about sales, and look at the table Product with 4 lines for the example:

Product Category Value  
P1 C3 10  
P2 C1 50  
P3 C1 30  
P4 C2 40

Hence, the total of value is 130, and the table that I wish to display is

Product Share of value  
P1 8 %  
P2 38 %  
P3 23 %  
P4 31 %

But, if I filter my table by category C1, then my display becomes  
Product Share of value  
P2 62 %  
P3 38 %

Meaning that my total of reference needs to be dinamically computed depending on the filter applied on the table displayed on the layout.

is there a way to do that ?

Thank you

Pascal

---

<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 3, 2023, 6:10pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/4 "2023-06-03T18:10:30Z")

</div>

Okay, I see.

There is no way to do this with the native Glide filtering. The only way to do it would be to create your own custom filter.

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://community.glideapps.com/u/Pascal)\
**Post date:** [June 3, 2023, 6:14pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/5 "2023-06-03T18:14:28Z")

</div>

Thank you Darren,  
I will investigate about custom filters  
regards,  
Pascal

---

<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:** [June 3, 2023, 11:29pm UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/6 "2023-06-03T23:29:17Z")

</div>

To create a custom filter

- Add a user-specific column to the table you’re filtering on.
- Add a choice component and point it to the column above.
- Assuming you allow multiple choices, create a split text column to return an array of choices.
- Create a multiple relation to the category column.
- Create a rollup to sum the value from the relation above.
- Cast the rollup to all rows of the product table either using a single value column or a relation/lookup combo.
- Create a math column to calculate the percentage.
- Show the final table, which should be built from the relation in the 4th step, and the corresponding “share of value”.

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://community.glideapps.com/u/Pascal)\
**Post date:** [June 4, 2023, 7:22am UTC](https://community.glideapps.com/t/vertical-ratio-on-a-table/62419/7 "2023-06-04T07:22:33Z")

</div>

Thank you,  
I will try that  
Regards  
Pascal
