# OFFSETBY

OFFSETBY( `offset column`, `number of rows`, `partition column`, `sort column`)

Returns a reference to a row relative to the current row, determined by the input `number of rows`. The offset is partitioned by a given column, or set of columns, and the offset calculation is determined by a sort parameter optionally provided.

{% hint style="info" %}
OFFSETBY() is a [**window function**](/cascade/functions-and-expressions/building-expressions/guide-to-window-functions.md), which performs like OFFSET() except partitioned by the unique values of a different column.
{% endhint %}

### Arguments

| Argument           | Description                                                                                  |
| ------------------ | -------------------------------------------------------------------------------------------- |
| `offset column`    | Column to return.                                                                            |
| `number of rows`   | Number of rows to offset. `number of rows` can be positive or negative.                      |
| `partition column` | A column, or set of columns, to partition the ranking by.                                    |
| `sort column`      | Optional, defaults to `offset column` . Sort value to use when determining the offset value. |

### Output

Offset value

### Example

{% embed url="<https://datawrapper.dwcdn.net/L344G/1/>" %}


---

# 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.cascade.io/cascade/functions-and-expressions/functions/table/offsetby.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.
