4.4 Sample, Select Records & Unique Tools

Key Takeaways

  • The Sample tool extracts record subsets using six configurable methods: First N rows, Last N rows, Skip 1st N rows, 1 of every N rows, 1 in N chance to include each row, and First N% of rows.
  • Enabling Grouping Fields in the Sample tool causes the sampling operation to reset its counter per unique group, extracting the specified sample independently from each category.
  • The Select Records tool extracts specific row positions and numeric ranges using concise syntax (e.g., '1-10', '100+', '-5', '1, 3, 5'), preserving schema without altering data types.
  • The Unique tool features one input anchor and two output anchors: 'U' (Unique) for the first occurrence of each distinct key and 'D' (Duplicate) for all subsequent identical records.
  • The Unique tool is strictly case-sensitive and routes the first encountered [Null] value to the Unique (U) anchor and subsequent [Null] values to the Duplicate (D) anchor.
Last updated: August 2026

4.4 Sample, Select Records & Unique Tools

Core Concept: Record sampling, index-based row selection, and deduplication are foundational data preparation workflows in Alteryx Designer. The Sample, Select Records, and Unique tools (all located in the Preparation palette) allow analysts to isolate representative test samples, extract specific row ranges, and isolate or remove duplicate records.


1. The Sample Tool: Modes & Grouping Mechanics

The Sample tool limits incoming data streams to a specified number, percentage, or frequency of records.

┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Sample (24) - Configuration                                                            │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ Select Sample Type:                                                                    │
│   ( ) First N rows                 N = [ 10      ]                                     │
│   ( ) Last N rows                                                                      │
│   ( ) Skip 1st N rows                                                                  │
│   (•) 1 of every N rows                                                                │
│   ( ) 1 in N chance to include each row                                                │
│   ( ) First N% of rows                                                                 │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ Grouping Fields (Optional):                                                            │
│   [✓] Store_Region                                                                     │
│   [ ] Department                                                                       │
└────────────────────────────────────────────────────────────────────────────────────────┘

The 6 Sampling Methods

Sampling MethodConfiguration Value ($N$)Behavior / FormulaPrimary Use Case
First N rowsInteger (e.g., 100)Extracts rows $1$ through $N$ from the top of the streamRapid testing, inspecting top ranked records
Last N rowsInteger (e.g., 50)Extracts the final $N$ rows from the bottom of the streamInspecting recent log entries, totals rows
Skip 1st N rowsInteger (e.g., 3)Drops rows $1$ through $N$; passes row $N+1$ to the endStripping multi-line metadata headers
1 of every N rowsInteger (e.g., 5)Returns the first row of every group of $N$ rows — rows 1, $N$+1, 2$N$+1, ... (with $N$=5: rows 1, 6, 11)Systematic interval sampling, thinning dense series
1 in N chance to include each rowInteger (e.g., 10)Independent Bernoulli trial per row, so $N$ is only an approximation: 1,000 rows at $N$=10 may return anywhere from ~75 to ~150 records, not exactly 100Statistical auditing, unbiased test datasets
First N% of rowsNumber (e.g., 25)Extracts top N% of total dataset rowsProportional sampling across entire dataset

Grouping Fields in the Sample Tool (High-Yield Core Concept)

When one or more Grouping Fields are checked in the configuration window:

  • The Sample tool resets its counter for each unique group in the data stream.
  • Example: A dataset contains 1,000 sales transactions across 5 distinct Store_Region values (200 rows per region). If the Sample tool is configured for First 3 rows with Store_Region selected as a grouping field, the tool outputs exactly 3 × 5 = 15 records (the first 3 records of Region 1, the first 3 records of Region 2, etc.).

2. The Select Records Tool: Range Syntax & Positioning

The Select Records tool outputs specific individual records or contiguous/non-contiguous ranges of records based on their vertical row index.

┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Select Records (31) - Configuration                                                    │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ Ranges: [ 1-10, 25, 50-75, 100+                                                      ] │
└────────────────────────────────────────────────────────────────────────────────────────┘

Range Syntax Reference

Syntax PatternMeaningExample Records Returned
5Single row numberOnly record 5
1-10Contiguous range from row $A$ to row $B$Records 1 through 10 inclusive
-5Open-ended range from start to row $N$ (same as 1-5)Records 1, 2, 3, 4, 5
100+Open-ended range from row $N$ through the end of datasetRecord 100 through the last record
1, 3, 5, 7Comma-separated list of individual recordsRecords 1, 3, 5, 7
1-5, 20-25, 50+Mixed combination of ranges and open-ended boundsRecords 1-5, records 20-25, and record 50 onward

Architectural Characteristics

  • Single Input / Single Output Anchor: Unlike the Filter or Unique tools, Select Records has only one output anchor. Unselected records are discarded and cannot be routed to a secondary stream.
  • Zero Schema Alteration: Preserves all existing column names, data types, and sizes without modifications.

3. The Unique Tool: Dual Anchors & Deduplication Mechanics

The Unique Tool checks for duplicate records based on one or more designated key columns, separating unique records from duplicate records.

┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Unique (15) - Configuration                                                            │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ Unique Fields:                                                                         │
│   [✓] Customer_ID                                                                      │
│   [✓] Order_Date                                                                       │
│   [ ] Transaction_Amount                                                               │
└────────────────────────────────────────────────────────────────────────────────────────┘

Dual Output Anchor Routing (U vs. D)

  • Input Anchor (I): Accepts the incoming data stream.
  • Unique Output Anchor (U): Receives the very first occurrence of each unique key value or key combination.
  • Duplicate Output Anchor (D): Receives all subsequent occurrences (the 2nd, 3rd, 4th, etc.) that match an already-encountered key.
Incoming Stream (I)          Unique Anchor (U) Output          Duplicate Anchor (D) Output
────────────────────         ────────────────────────          ───────────────────────────
Row 1: [ID: 101, "TX"] ────► Row 1: [ID: 101, "TX"] (1st seen)
Row 2: [ID: 102, "CA"] ────► Row 2: [ID: 102, "CA"] (1st seen)
Row 3: [ID: 101, "NY"] ───────────────────────────────────────► Row 3: [ID: 101, "NY"] (2nd seen)
Row 4: [ID: 103, "FL"] ────► Row 4: [ID: 103, "FL"] (1st seen)
Row 5: [ID: 101, "WA"] ───────────────────────────────────────► Row 5: [ID: 101, "WA"] (3rd seen)

Key Operational Rules of the Unique Tool

  1. Composite Multi-Field Keys: If multiple fields are checked (e.g., Customer_ID and Order_Date), a record is only treated as a duplicate if both field values match an earlier record.
  2. Case Sensitivity: The Unique tool is strictly case-sensitive. The values "Alteryx", "ALTERYX", and "alteryx" are treated as three distinct unique values and will all pass to the U anchor.
  3. Null Handling: The very first record containing [Null] in the key field passes to the U anchor. Every subsequent record containing [Null] passes to the D anchor.

4. Comparison Matrix: Sample vs. Select Records vs. Unique vs. Filter

FeatureSample ToolSelect Records ToolUnique ToolFilter Tool
Output Anchors1 (O)1 (O)2 (U, D)2 (T, F)
Selection CriteriaSampling algorithm ($N$, %, frequency)Explicit row index / rangeDistinct key valuesValue-based boolean condition
Supports Grouping?Yes (Resets sample per group)NoYes (Composite key selection)No
Captures Discards?NoNoYes (Via D anchor)Yes (Via F anchor)
Case SensitivityN/AN/AYes (Case-sensitive)Based on expression / operator
Loading diagram...
Unique Tool Anchor Routing and Deduplication Pipeline
Test Your Knowledge

An analyst configures a Select Records tool with the range specification '-3, 7, 10+'. Which records from a 12-row dataset are passed to the output?

A
B
C
D
Test Your Knowledge

A dataset contains 40 records representing 4 departments (Sales, Marketing, IT, Finance) with exactly 10 records per department. A Sample tool is configured for 'First 3 rows' with Department selected as a Grouping Field. How many total records are output by the Sample tool?

A
B
C
D
Test Your Knowledge

A dataset containing 5 records with the values 'A', 'B', 'A', 'C', 'A' in the Category column is passed into a Unique tool with Category selected. How many records exit through the Unique (U) and Duplicate (D) output anchors?

A
B
C
D
Test Your Knowledge

A dataset contains the following records in a column named Product: 'Alteryx', 'alteryx', 'ALTERYX', [Null], [Null]. If this column is passed into a Unique tool configured on Product, how many records emerge from the Unique (U) anchor?

A
B
C
D