LastChild (PQL)

Executes last child aggregation on a column of data from the model. The column must contain numerical data for it to be functional.

  • Returned Output: Numeric
  • Library: PQL \ Semantic \ Aggregate
  • Version: 2023.00.000
  • Compatibility: Pyramid Query Language (PQL) data sources

Syntax

LastChild( <Measure> )

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

Comments

The LastChild function in Pyramid Analytics PQL is used to return the last child of a specified member in a hierarchy. This function is useful when you need to retrieve or work with the last item in a hierarchical level, such as the last month of a year, the last employee reporting to a manager, or the last product in a category.

Parameters
  • member: The member in the hierarchy for which you want to retrieve the last child.
How It Works
  • The function navigates through the hierarchy to find the last child of the specified member.
  • The "last" child is determined by the natural order of the hierarchy, which is typically defined by the data model or the order in which the data is arranged.

Example

LastChild([Products].^[Products].CurrentMember)

You can see the effect from this example snippet in column #4 – LastChild, based on the products hierarchy and sales amount columns in position #1 and #2: