The Choose function assigns every row the value with the corresponding index position based on an input number or column. If a number is specified as the index number argument, only the value in the corresponding index position of the function header is returned. If the index number argument is a column, the value that corresponds to each row's index number is returned.
Choose(index number, value 1, ...)
- index number (required)- The index number of the value returned.
- value 1 (required)- The values from which to choose. At least one value must be provided.
- value 2+ (optional)- Additional values are optional.
When an index number is provided and a corresponding value does not exist, Null is returned.
The index number argument needs to be a number, a formula or column that references a value of Number data type.
The value argument(s) can be Number, Logical, or Date types.
Choose(1, "value 1", "value 2", "value 3")
- Returns value 1.
Choose(Weekday([Date]), "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
- Returns the name of the day of the week falling on the date in the [Date] column.
Choose([Cohort Bins], "One Week", "One Month", "Over a Month"
- Returns the Time to Sale bucket each customer belongs to based on the Days First to Second Order column, which indicates the number of days between their first and second purchase.