---
title: Monotonic Sequence
description: Validates that numeric sequences in a dataset follow a consistent ascending or descending order, optionally enforcing strict monotonicity.
group: Validity
---

# Monotonic Sequence

The **Monotonic Sequence** rule checks whether numeric values in a dataset are ordered consistently in either ascending or descending order.  
This rule is commonly used to:

- Validate time series data or version numbers for logical progression.
- Detect data entry errors where numbers break expected order patterns.

**Example Usage**:  
Ensure customer transaction numbers always increase in order of transaction date, or product prices decrease progressively in a markdown list.

---

## Configuration Fields  

### Rule-Specific Configuration  

| Field Name      | Description                                                  | Required | Data Type / Options |
|:----------------|:-------------------------------------------------------------|:-----------|:--------------------|
| **Order Type**    | The direction of the expected sequence                       | Yes       | `Ascending`, `Descending` |
| **Strict**        | Whether the sequence should be strictly monotonic (no equal consecutive values allowed) | Yes       | `true` / `false` |

---

### Success Criteria Configuration  

This section defines how the rule’s outcome is measured against expected thresholds.

| Field Name        | Description                                                  | Required | Options / Format |
|:------------------|:-------------------------------------------------------------|:-----------|:-----------------|
| **Operator**        | Comparison operation for the result count                    | Yes       | `GreaterThan`, `LessThan`, `EqualTo`, `Between` |
| **Threshold Value** | Value for comparison (for `GreaterThan`, `LessThan`, `EqualTo`) | Conditional| Number |
| **Threshold Min**   | Minimum value (for `Between` operator)                        | Conditional| Number |
| **Threshold Max**   | Maximum value (for `Between` operator)                        | Conditional| Number |
| **Is Percentage**   | Whether the threshold represents a percentage or an absolute count | No        | `true` / `false` (default: `false`) |
| **Allow Nulls**     | Whether null values are considered valid                     | No        | `true` / `false` (default: `false`) |
| **Check For Match** | When `false`, validates for negation of the condition         | No        | `true` / `false` (default: `true`) |

---

## Sample Input Data  

| ID | Customer       | Number       |
|:----|:----------------|:---------------|
| 1  | Aubrey          | 83457          |
| 2  | Fallon          | 23455          |
| 3  | FranklynFryer   | 46573          |
| 4  | Kathleen        | 96784          |
| 5  | JudieGreen      |                |

---

## Sample Configurations  

### Example 1: Ascending Monotonic Check (Strict)



| Configuration Field | Value         |
|:---------------------|:---------------|
| Column                | Number          |
| Order Type             | Ascending        |
| Strict                 | true             |
| Operator               | LessThan         |
| Threshold Value        | 50               |
| Is Percentage          | false            |
| Allow Nulls            | false            |


**Explanation**:  
Validates that the sequence of values in the `Number` column follows a strictly increasing order, and no more than 50 records can fail this check.

---

### Example 2: Descending Non-Strict Monotonic Check  



| Configuration Field | Value         |
|:---------------------|:---------------|
| Column                | Number          |
| Order Type             | Descending       |
| Strict                 | false            |
| Operator               | GreaterThan      |
| Threshold Value        | 80               |
| Is Percentage          | true             |
| Allow Nulls            | true             |
| Check For Match        | true             |

**Explanation**:  
Validates that at least 80% of values in the `Number` column follow a descending order, allowing equal consecutive values.

---

## Sample Output  

| Column Name | Rule Name               | Success Count | Failure Count | Null Count | Within Threshold |
|:------------|:------------------------|:---------------|:---------------|:------------|:------------------|
| Number       | Monotonic Sequence Check | 4             | 1             | 0          | No                |
| Customer     | Monotonic Sequence Check | 2             | 3             | 1          | Yes               |

---
