SAMPLE DAX Function (Statistical)
Returns a sample subset from a given table expression.
Syntax
Parameter | Attributes | Description |
---|---|---|
Size |
Number of rows in the sample to be returned. |
|
Table Iterator |
A table expression from which the sample is generated. |
|
OrderBy Row Context |
Repeatable |
A scalar expression evaluated for each row of the table. |
Order | Optional Repeatable |
The order to be applied. 0/FALSE/DESC – descending; 1/TRUE/ASC – ascending. |
Return values
A table consisting of a sample of Size rows of table or an empty table if Size is 0 (zero) or less.
Remarks
A table consisting of a sample of N rows of table or an empty table if Size is 0 (zero) or less.
One OrderBy argument is required. The returned sample will be stable and deterministic, returning the first row, the last row, and evenly distributed rows between them.
If Size is 0 (zero) or less then SAMPLE returns an empty table.
In order to avoid duplicate values in the sample, the table provided as the second argument should be grouped by the column used for sorting.
Last update: Jan 23, 2021 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
MSDN documentation: https://docs.microsoft.com/en-us/dax/sample-function-dax