RATIO_TO_REPORT

functionsupportedCore SQL functions

docs.snowflake.com ↗

Window functions

Returns the ratio of a value within a group to the sum of the values within the group. If expr1 evaluates to null or the sum of expr1 within the group evaluates to 0, then RATIO_TO_REPORT returns null.

Syntax

supportedpartialnot supportednot scored

RATIO_TO_REPORT( <expr1> ) [ OVER ( [ PARTITION BY <expr2> ]
  [ ORDER BY <expr3> ] [ { ASC | DESC } ] [ NULLS { FIRST | LAST } ] ) ]

Parameters

NameRequiredDescription
expr1requiredThis is an expression that evaluates to a numeric data type (INTEGER, FLOAT, DECIMAL, etc.).
expr2requiredThis is the optional expression to partition by.
expr3requiredThis is the optional expression to order by within each partition. Note that for this function, the order within the partition does not affect the output. In this function, as in all window functions, this ORDER BY does not control the order of the entire query output.

Usage notes