v.20.1New Feature
Added avgWeighted Function for Weighted Average Calculation
Added new aggregate function avgWeighted which allows to calculate weighted average. #7898 (Andrey Bodrov)Why it matters
TheavgWeighted function addresses the need to compute an average where each value contributes proportionally to its assigned weight, providing more accurate aggregated results in scenarios where some data points are more significant than others.How to use it
Use theavgWeighted aggregate function in your SQL queries by passing two arguments: the value and its corresponding weight. For example:SELECT avgWeighted(value, weight) FROM table