# 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

```javascript
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

{% code overflow="wrap" %}

```javascript
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
```

{% endcode %}

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.

<figure><img src="https://github.com/lumelinc/PowerTableDocs/blob/main/.gitbook/assets/image%20(2784).png" alt=""><figcaption><p>SELECT_BYINDEX</p></figcaption></figure>

{% hint style="info" %}
Users are recommended to use the SELECT\_BYINDEX function when working on reports containing time-series dimensions in columns.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fabricplan.com/planning-sheets/formula-syntax/measure-column-selection-functions/select_byindex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
