Skip to main content

Three partially full beakers Sample Tool

One Tool Example

Sample has a One Tool Example. Go to Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

Use Sample to limit the data stream to a specified number, percentage, or random set of rows. In addition, the Sample tool applies the selected configuration to the columns selected to group by.

Configure the Tool

  1. In the Sample Method section, select the type of sample. The options are...

    • First N rows: Returns every row in the data from the beginning of the data through row N.

    • Last N rows: Starting from the row that is N rows away from the end of the data, returns every row through to the end of the data.

    • Skip 1st N rows: Returns all rows in the data starting after row N.

    • 1 of every N rows: Returns the first row of every group of N rows.

    • 1 in N chance to include each row: Randomly determines if each row is included in the sample, independent of the inclusion of any other rows. This method of selection results in N being an approximation.


      If you have 1,000 rows, select a random sample, and specify N as 10, you might expect to get 100 rows returned. However, you might get anywhere between 75 and 150 records returned.

    • First N% of rows: Returns N percent of rows. This option requires the data to pass through the tool twice: once to calculate the count of rows and again to return the specified percent of rows.

  2. Enter a number in the N= box to specify the value for N.

  3. Group by column (optional): Select columns from your dataset to group by. Use the Select all check box if you want to group by all columns. If a group or groups are specified, N rows are returned for each group.


    If you choose to Group by a column named City, specify N as 2, and select First N Rows, Alteryx returns the first 2 rows for each City.