countBy
countBy returns the number of rows for each group.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| countColumnName | String | The name of the output column containing the count. |
| groupByColumns | String... | The column(s) by which to group data.
|
| groupByColumns | ColumnName... | The column(s) by which to group data.
|
| groupByColumns | Collection<String> | The column(s) by which to group data.
|
Returns
A new table containing the number of rows for each group.
Examples
In this example, countBy returns the number of rows in the table and stores that in a new column, Count.
In this example, countBy returns the number of rows in the table as grouped by X and stores that in a new column, Count.
In this example, countBy returns the number of rows in the table as grouped by X and Y, and stores that in a new column Count.