# Weighted Summarization

**URL:** <https://connect.superhuman.com/t/weighted-summarization/19231>\
**Category:** Ask the Community\
**Created:** [October 29, 2020, 1:46am UTC](https://connect.superhuman.com/t/weighted-summarization/19231 "2020-10-29T01:46:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oren\_Pinsky](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/oren_pinsky/32/17661_2.png) [@Oren\_Pinsky](https://connect.superhuman.com/u/Oren_Pinsky)\
**Post date:** [October 29, 2020, 1:46am UTC](https://connect.superhuman.com/t/weighted-summarization/19231/1 "2020-10-29T01:46:20Z")

</div>

I have a table that has, for several items, the cost and the current value of the item:

Item. Cost. Value. Multiple (formula = value/cost)  
A. 10. 20. 2  
B. 5. 15. 3  
C. 1. 1. 1  
D. 10. 5. 0.5

For this table I need a summary. For Cost & Value, i can use the Sum function and it works just fine. For the multiple, none of the preset aggregators work, as I would need a weighted-average aggregator. I would need to calculate the sum of value for all items and divide by the sum of cost for all values. averaging the ratios would generate incorrect results.

How should I do this?

---

<div class="post-metadata">

**Author:** ![Ander](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/ander/32/9134_2.png) [@Ander](https://connect.superhuman.com/u/Ander)\
**Post date:** [October 29, 2020, 2:27am UTC](https://connect.superhuman.com/t/weighted-summarization/19231/2 "2020-10-29T02:27:30Z")

</div>

@Oren_Pinsky

For more traditional spreadsheet use cases (rather than relational data), I frequently just throw it together as shown below. It’s not as presentable as having summaries inline with their source data, but such are the tradeoffs.😀

https://coda.io/embed/sqJnb0YFQ7/_sumKa?viewMode=embedplay

---

<div class="post-metadata">

**Author:** ![Mario](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mario/32/12232_2.png) [@Mario](https://connect.superhuman.com/u/Mario)\
**Post date:** [October 29, 2020, 7:38am UTC](https://connect.superhuman.com/t/weighted-summarization/19231/3 "2020-10-29T07:38:00Z")

</div>

Hi @Oren_Pinsky 🙂  
Welcome to the Community 🙂

The answer from @Ander works but if you prefer an approach a little bit more “coda-friendly” i can propose mine:

You have a first table that contains all your data  
Below it you have a second table that calculate all your desired totals 🙂 (so then inside those column you can write formulas as advanced as you like 🙂

Another option could be to use canvas formulas, you just write something like:

Cost & Value Multiple: =sum()/sum()

The final result can be formatted and styled 🙂

The first solution can be better if you have also other dataset where you want to perform the same calculi, the second is if you dont 🙂

Have a nice day,

Mario

---

<div class="post-metadata">

**Author:** ![Oren\_Pinsky](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/oren_pinsky/32/17661_2.png) [@Oren\_Pinsky](https://connect.superhuman.com/u/Oren_Pinsky)\
**Post date:** [October 29, 2020, 11:41am UTC](https://connect.superhuman.com/t/weighted-summarization/19231/4 "2020-10-29T11:41:31Z")

</div>

Many thanks @Mario and @Ander. I am using the table grouping feature, so I was hoping to be able to use the summarization features built-into the table. As this is apparently not possible - as there is no ‘weighted average’ function for group summaries (only sum, max, count, etc) I will experiment with your solutions!

Also, it would be great to suggest a feature request to coda so that they can implement the weighted average function as per above. How should I do it?

Thanks

---

<div class="post-metadata">

**Author:** ![Mario](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mario/32/12232_2.png) [@Mario](https://connect.superhuman.com/u/Mario)\
**Post date:** [October 29, 2020, 2:11pm UTC](https://connect.superhuman.com/t/weighted-summarization/19231/5 "2020-10-29T14:11:37Z")

</div>

Happy to help @Oren_Pinsky 🙂

To communicate with coda your ideas for new features you can create a new post here in the community in the suggestions category, or let’s wait for them here 🙂 [@superhumans](https://connect.superhuman.com/groups/superhumans)

---

<div class="post-metadata">

**Author:** ![Ander](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/ander/32/9134_2.png) [@Ander](https://connect.superhuman.com/u/Ander)\
**Post date:** [October 29, 2020, 2:53pm UTC](https://connect.superhuman.com/t/weighted-summarization/19231/6 "2020-10-29T14:53:45Z")

</div>

> [@Oren\_Pinsky](#):
>
> so that they can implement the weighted average function as per above.

`column menu > summarize > list of options`

A `Custom formula` option here would be powerful.🕶
