Weighted Average

Hello!

I have two tables, and I need to be able make a column in one do  a weighted average  with values in another. I know how to do the normal average, using the following formula:

 

AVERAGE(
SELECT(Atualizaรงรตes[Quantos dias para vencer],
AND(
([Produto] = [_THISROW].[Produto]), 
([Loja] = [_THISROW].[Loja])
)
)
)

 

 But the problem is that need to do the weight average instead of the normal average, using the quantity of each product as weights, so basically  it needs to be like (example): (quantity1 * missing day1 +  quantity2 * missing day2)/ (quantity1 * quantity2) - using the informations of each row in the table that matches the sotre and product (the selected condition in the formula above)
I thought I could do a loop similar to a form, but I also couldn't do it and didn't find any material online

Does anybody knows how to solve it, please?

0 1 53
1 REPLY 1

Hello Beatriz and welcome to the community!

I'm not sure that's the correct way to calculate a weighted average; why do you multiply quantities together? Averages do not have squared units. 

In any case, please share screenshots of your tables so that we can better help. Thank you.

Top Labels in this Space