Subset (PQL)

Returns a subset of members from a specified set.

  • Returned Output: List
  • Library: PQL \ Semantic \ List
  • Version: 2023.10.000
  • Compatibility: Pyramid Query Language (PQL) data sources

Syntax

Subset( <List> , <Integer> , OPTIONAL <Integer> )

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

Comments

Subset returns a subset of the original list, beginning at the specified start position. The returned list either includes all values from the start position (where no optional second integer is included) or it uses the optional second integer as a "count" that indicates how many items should be returned.

  • The list is a set of elements from a hierarchy.
  • The list is zero-indexed, meaning that its first item is at position zero (0), the next item is at position 1, and so on.
  • The first integer (required) is the "start" position. It is the position of the first element to be returned from the list.
  • The second integer (optional) is the "count." It is the total number of values that should be returned from the list. (If the count is higher than the number of available values after the start, then Pyramid will return the available values from the start position without reporting an error.)
  • For details on how to employ and use this function see the semantic calculation overview.
Different Function types

This function is like the MDX Subset function, returning a smaller subset of an original list.

Examples

The following example returns a set of 10 items from the full set of date-keys (returned using AllMembers), starting at position 5:

Subset( {[Date].[dateKey].allmembers}, 5, 10 )

Note: If there are only 8 date-keys after the date-key at position 5, the returned set will contain 8 date-keys.