---
url: /cube-functions/levelsbetween.md
description: >-
  Returns the number of steps from the Ancestor specified to the Descendant
  specified.
---

# LEVELSBETWEEN

Returns the number of steps from the Ancestor specified to the Descendant specified.

```js
LEVELSBETWEEN(dimension, ancestor, descendant, hierarchy)
```

#### Parameters

* `dimension` - The dimension to source the sequence from.
* `ancestor` - The ancestor to count the amount of steps from.
* `descendant` - The descendant to count the amount of steps to.
* `hierarchy` - The name of the hierarchy, used to determine levels between within a specific hierarchy. `(optional)`

#### Examples

```js
LEVELSBETWEEN("Account", "EBITDA", ELEMENT("Account"))
```
