Multiply each item from a column with the corresponding of another column, then sum

Hello, hope you are doing great.

Basically, what i need to do is multiply the values from two different columns that matches an id from another column and then only sum by matching id the result of each multiplication. 

Here is a table for you to see what I need.

table example.png

I need to get the sum_id_xxx, sum_id_yyy, sum_id_zzz values.

This is the expression that i've come up with, but it doesnt work, always return 0:

sum(

SELECT(generic_table_name[column_a];[id_column]=[_thisrow].[id_column])

*

SELECT(generic_table_name[column_b];[id_column]=[_thisrow].[id_column])

)

Can anyone please help me with this?

Best regards,

Federico.

 
Solved Solved
0 2 339
1 ACCEPTED SOLUTION

SUM(SELECT(generic_table_name[column_a*column_b];[id_column]=[_thisrow].[id_column]))

View solution in original post

2 REPLIES 2
Top Labels in this Space