COUNTBY
Counts the number of values within a column, partitioned by the unique values of a separate column
COUNTBY( column
, partition column
)
Counts the number of values within a column
when grouped by unique values within a partition column
.
COUNTBY() is a window function, which performs COUNT() except partitioned by the unique values of a separate column.
Arguments
Input | Description |
| Column to count |
| Column containing unique values. |
Output
Outputs a count of values when grouped by partition column
.
Example
In this example, we want to count the number of non-null cells in {Adult Population}
, partitioned by {Region}
.
Last updated