INDEXBY
Returns a value of a specific index within a column, partitioned by the unique values of a separate column
Last updated
Returns a value of a specific index within a column, partitioned by the unique values of a separate column
Last updated
INDEXBY( column
, integer
, partition column
, [sort column]
, [ascending]
)
Indexes a given column when grouped by unique values within a partition column
INDEXBY() is a window function, which performs like INDEX() except partitioned by the unique values of a different column.
Argument | Description |
| Column to index |
| Index of indexed |
| Column containing unique values |
| Optional. Column with which to sort partitioned rows by. Defaults to index. |
| Optional. Enter |
Outputs a given index from each partitioned group within the indexed column
Let's say that we want to find the first state in each region in a table. We have a table that lists each state and its corresponding region -- by using INDEXBY({State}, 1, {Region})
, we can select the first state for whatever region that state is in.