Column total as row value in another table

Hi! I have two tables as shown in the embed below. Context -

  • The values in cells of Table A will keep changing & new Items i.e. rows maybe added later.
  • Number of columns & their names (Property#1, Property#2 etc. ) are fixed.

Questions -

  1. In Table B, I want to show the total of each Property from Table A.
  2. Ideally, I would want these Properties in Table A to be inside each Item’s respective canvases & still show their totals in Table B.

Being new to Coda, I searched the questions here in Community but from what I read, getting the sum of columns as row values is not possible as formulas are applied column-wise. Or I misunderstood :sweat_smile: I feel like there should be a simple solution.

How can I get this done? Thank you.

in general you can do this as follows

in the TableB you have a column with this formula

TableA.ColumnX.Sum()

which works like this

  • TableA.ColumnX returns a list of all the values in the column

  • .Sum() takes the list, sums its elements and returns the total

if you need to only sum a subset of the items, then you filter the list, for example…

TableA.Filter(ColumnY>99).ColumnX.Sum()

the Filter() selects only the rows in TableA where the condition is TRUE, ie: where ColumnY is greater than 99

hope that helps

max

1 Like

Hi, thanks for the answer. If I understand it right, the filtering is happening on Table A’s end. I want the values in Table B to show each column’s total based on which row it is. That is, something like this for Table B - if current Row name = “Property#1”, get sum of TableA.Property#1 column. And similarly for the rest of row names of Table B.

Anyway, I found a workaround which is to simply create 3 different tables each with 1 row only that corresponds to each of the column names in Table B. So, it’s solved for now, maybe I can find a more compact solution later.

Thank you.

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