---
url: /process-functions/hierarchy-parentcount.md
description: Returns the number of immediate parents an element has in a hierarchy.
---

# hierarchy.parentCount

Returns the number of immediate parents an element has in a hierarchy.

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

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `dimension` | `string` | The dimension's name or id. |
| `hierarchy` | `string` | The hierarchy's name or id. |
| `element` | `string` | The element's name. |

## Returns

The number of parents, or `-1` when the dimension, hierarchy or element can't be found.

## Examples

```js
const count = hierarchy.parentCount("Account", "Management Profit and Loss", "EBIT");
```
