DAX Functions

SAMPLE Function

Pinterest LinkedIn Tumblr

DAX SAMPLE Function is categorized under Filter functions. This function returns a sample subset from a given table expression.

DAX-SAMPLE-Function

Purpose of DAX SAMPLE Function

The DAX SAMPLE function helps to get a table consisting of a sample of N rows of table or an empty table if n_value is 0 (zero) or less. 

Return value

The SAMPLE function returns a sample of N rows from the specified table.

Syntax

= SAMPLE (<n_value> , <table> , <orderBy_expression> , [<order>] , [< orderBy_expression >, <order.]] .. )

Arguments

ArgumentsDescriptionRemarks

n_value

The number of rows to return as a sample.
It is any DAX expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context).
If a non-integer value (or expression) is entered, the result is cast as an integer.
Mandantory

table
Any DAX expression that returns a table of data from where to extract the n_value number of rows. Mandantory

orderBy_expression
Any scalar DAX expression where the result value is evaluated for each row of table. Optional

order
A value that specifies how to sort orderBy_expression values.
0/FALSE: Sorts in descending order of values of orderBy_expression.
1/TRUE: Sorts in ascending order of values of orderBy_expression.
If omitted, default is 0.
Optional

Usage notes

  • SAMPLE returns an empty table, If n_value is 0 (zero) or less.
  • The table provided as the second argument should be grouped by the column used for sorting to avoid duplicate value in the sample.
  • If no ordering is specified, the sample will be random, not stable, and not deterministic.

Related Posts

More off this less hello salamander lied porpoise much over tightly circa horse taped so innocuously outside crud mightily…

Write A Comment