Levels (PQL)

Returns a level from the specified position in the hierarchy tree.

  • Returned Output: Level
  • Library: PQL \ Semantic \ Hierarchical
  • Version: 2020.10.000
  • Compatibility: Pyramid Query Language (PQL) data sources


Levels( <Hierarchy> , <Integer> )

Syntax Alternatives

<Hierarchy> .Levels()

* Click on the function's arguments above for more details on the input values.

  • The hierarchy needs to be the unique name of a regular hierarchy.
  • The function will not work on drill-path hierarchies.
  • The position can be a value or numeric expression.
  • For details on how to employ and use this function see the semantic calculation overview.
Different Function types
  • This function is like the MDX levels function.


This example returns the level "State" since its the second level in the Geo Location hierarchy after country.

[Customer].^[Geo Location].Levels(2)

This example returns the level "Month" since its the third level in the Date hierarchy after year and quarter.