---
url: /process-functions/hierarchy-parentbyindex.md
description: Returns the name of one of the immediate parents of an element in a hierarchy.
---

# hierarchy.parentByIndex

Returns the name of one of the immediate parents of an element in a hierarchy.

```js
hierarchy.parentByIndex(dimension, hierarchy, element, index)
```

#### Parameters

* `dimension` - The dimension in which the selected hierarchy exists.
* `hierarchy` - The identifier of the hierarchy to search.
* `element` - The identifier of the parent element.
* `index` - A Zero-based index of the parent to return.

#### Example

```js
let parent = hierarchy.parentByIndex("Account", "Management Profit and Loss", "EBIT", 0);
```

:::tip
The `parent` variable will be the name of the first parent of the element `EBIT` in the `Management Profit and Loss` Hierarchy.
:::
