SELECT_BYINDEX

The SELECT_BYINDEX function returns an array of measure values by selecting columns based on their numerical positions, from the start index to the end index. It should be used in conjunction with an aggregate function such as SUM, AVERAGE, etc.

Syntax

SELECT_BYINDEX(measure,start_index,end_index)

Arguments

measure - String. Specify the name of the measure to select values from.

start_index - Number. The starting column index from which the data must be fetched (1-based indexing). Required. Index-based identifiers can also be used instead of numbers.

end_column - Number. The index of the ending column until which data has to be retrieved. Required. Index-based identifiers can also be used instead of numbers.

Return value

Array of data.

Example

SELECT_BYINDEX([Sales],1,3)

//Returns an array containing values from the first, second, and third columns of the 'Sales' measure

SUM(SELECT_BYINDEX([Sales],1,3))

//Calculates the sum of values from the first through third columns of the 'Sales' measure

In the following example, we used the SELECT_BYINDEX function to forecast values using the current quarter's actuals and the next three quarters' actuals.

Unlike the SELECT function, SELECT_BYINDEX allows you to use identifiers in the start and end column indexes, allowing you to perform cross-year data analysis that the SELECT function does not allow.

SELECT_BYINDEX

Users are recommended to use the SELECT_BYINDEX function when working on reports containing time-series dimensions in columns.

Last updated

Was this helpful?