Sample (PQL)

Returns a sample of N rows from the specified List.

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

Syntax

Sample( <List> , <Numeric> )

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

Comments
  • The List parameter should be a list or set of elements from an existing hierarchy in the model.
  • The numeric parameter indicates how many values should be returned from that hierarchy as a numeric expression.
  • For details about how to employ and use this function, see the semantic calculation overview.
Different Function types
  • There are two Sample functions; this function returns a set number of values as a sample, while the other returns a percentage of the total values. For details, see SamplePercent (PQL).

Examples

This example returns 1000 Transaction IDs selected as a random sample:

Sample([data].[transactionID].allMembers, 1000)

Note: If the number of items in the list is lower than the requested sample size (in this case, the transactionID list contains fewer than 1000 members), then all possible values are returned.