Vertical ratio on a table

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


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:

(Product Total / Total) * 100

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

1 Like

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


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.

1 Like

Thank you Darren,
I will investigate about custom filters

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”.
1 Like

Thank you,
I will try that

1 Like