Question: how to calculate weighted average in sql server?
Answer: Calculate the weighting factor for each detail row., Sum the weighting factor and the number of units sold., Divide the summed weighting factor by the summed units.