Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Documentation for weighted_avg(arg, weight) #4509

Merged
merged 3 commits into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/sql/functions/aggregates.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ The table below shows the available general aggregate functions.
| [`product(arg)`](#productarg) | Calculates the product of all non-null values in `arg`. |
| [`string_agg(arg, sep)`](#string_aggarg-sep) | Concatenates the column string values with a separator. This function is [affected by ordering](#order-by-clause-in-aggregate-functions). |
| [`sum(arg)`](#sumarg) | Calculates the sum of all non-null values in `arg`. |
| [`weighted_avg(arg, weight)`](#weighted_avgarg-weight) | Calculates the weighted average all non-null values in `arg`, where each value is scaled by its corresponding `weight`. If `weight` is `NULL`, the corresponding `arg` value will be skipped. |

#### `any_value(arg)`

Expand Down Expand Up @@ -458,6 +459,14 @@ The table below shows the available general aggregate functions.
| **Example** | `sum(A)` |
| **Alias(es)** | - |

#### `weighted_avg(arg, weight)`

<div class="nostroke_table"></div>

| **Description** | Calculates the weighted average of all non-null values in `arg`, where each value is scaled by its corresponding `weight`. If `weight` is `NULL`, the value will be skipped. |
| **Example** | `weighted_avg(A, W)` |
| **Alias(es)** | `wavg(arg, weight)` |

## Approximate Aggregates

The table below shows the available approximate aggregate functions.
Expand Down