---
url: /process-functions/hierarchy-offset.md
description: >-
  Returns the element a set number of positions before or after another element
  in a hierarchy.
---

# hierarchy.offset

Returns the element a set number of positions before or after another element in a hierarchy.

```js
hierarchy.offset(dimension, hierarchy, element, offset)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `dimension` | `string` | The dimension's name or id. |
| `hierarchy` | `string` | The hierarchy's name or id. |
| `element` | `string` | The element to start from. |
| `offset` | `number` | How many positions to move. Positive moves forward and negative moves back. |

## Returns

The element's name, or a message starting with `"Error:"` when it can't be found or the offset goes past the start or end of the hierarchy.

## Examples

```js
const element = hierarchy.offset("Account", "Profit and Loss", "EBITDA", 2);
```
