# Multiplication of items of two lists

Please I need help with a multiplication of items of two lists . I need to get result of formula (list1.item1 * list2.item1) + (list1.item2 * list2.item2) + (list1.item3 * list2.item3) … and so on. Is there any way how to do it automaticly?

Thanks

You want a function such as SUMPRODUCT but this one is not implemented as far as i know

First save all the subresults :
A = (list1.item1 * list2.item1)
B = (list1.item2 * list2.item2)
C= (list1.item3 * list2.item3)
and then Sum them all

For instance, you can’t directly get the sum of several orders (Price x Quantity) without calculating first the amount for each order.

OK, is there any way how to make subtotals automaticky?
I tried to do it by workflow on element in repeating group but I cant persuade it to work automaicky. I understand I need new list of subtotals (to be able to sum it) but I dont know the way how to get it.

for A, for isntance, best it to calculate it when the list1.item1 or list2.item1 is modified.

It is a bit tricky in my case. I have a simple ganttchart. Tasks in rows and weeks in columns. Now I am trying to make very bottom line with sums of scheduled hours per week.

So I have database item for every task. Every task has list parametr with list of days (it was only way I found to be able to sum amounts of scheduled days in week). Then every task has parametr workload per day (amount of hours). Now I need to sum subtotals for every task item of amount of hours mutiplied by workload. I have not find other way how to get list than “search”. And in case of search I am not able to make subtotals.

That’s a pretty cool interface there. How’d you get the bars to extend across the different weeks?

I put seven shapes into each week cell and control their visibility based on scheduled days numbers. E.g. CW 36, task 1 contains only days num. 5,6,7, then only these three shapes are visible.

1 Like

Any help with my trouble?

@emmanuel thinking about it, I see many use case for the :sumproduct function :
(Item1’s NumberA x Item1’s NumberB) + (Item2’s NumberA x Item2’s NumberB) + …

Apart from basic operations, I know it’s the function I use the most in Excel.

If i understand correctly it is impossible to do it natively in bubble. I tried using api connector with math.js but I have the same trouble. Can you recommand me some way to try. I need to find a way how to make this summary.

Where does the list come from ? Is it on the data base ?

I have tried to explain it here:

Or you want to now somethink different?

What I meant was … I this a list generated by a search parameter … Or is the user ticking boxes (or some other input) to select them ?

It is a search

And I am thinking the issue is that you can do list1:sum * list2:sum quite easily … that is the wrong number ?

If I needed something quickly, I would be tempted to schedule an API on the list, which would calculate the subtotals and then store it, you can then sum that. But it is awkward.

list1:sum * list2:sum is a wrong number.
Even in case of API I have not found the way how to prosess every sigle item from both lists. Do you have some example?

Are the lists from different things on the database ?

So item1 and item2 are not on the same record ?

I have one database record (task) with two parameters: 1. is list of days (which is a list and I need to count it) and multiply it with 2. parameter workload (which is a nuber).
I need ListOfTasks.record#1’s ListOfDays:count * ListOfTasks.record#1’s workload and do it for each item and then sum all this subtotals

What is the use case?

I tried to explain it here:

Is it what you want to know?