I’m facing a problem that I can’t find a viable solution.
I have a database that has a value (‘Valor Rateio’) (img 1) and a multivalue list of IDs in a column called (‘Lote’).
In another table (img 2), I have all possible IDs in column ‘Lote’ . I would like to calculate the sum of the products of each ID (‘Lote’) (img 3) in the table.
Example:
For Lot 1:
→ 3 times in the first line with a value of -100 = -300
→ 3 times in the second line with a value of -200 = -600
→ Result: -300 + (-600) = -900
For Lot 2:
→ 1 times in the first line with a value of -100 = -100
→ 1 times in the second line with a value of -200 = -200
→ Result: -100 + (-200) = -300
For Lot 3: → 5 times in the first line with a value of -100 = -500
→ 5 times in the second line with a value of -200 = -1000
→ Result: -100 + (-200) = -1500
Does anyone know how to do this calculation?