# Greater Than Check Examples

Source: https://userguide.qualytics.io/data-quality-checks/greater-than/deep-dive/examples/

Three real-world scenarios that show how the Greater Than check is typically used in production: enforcing a strict minimum on order totals, requiring a minimum tenure with an inclusive threshold and a filter, and tolerating rounding noise on a reconciled amount. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.

**Tab: Strict Minimum on Totals**

**The situation:** Every order must carry a total strictly above zero. Rows with `0` come from a checkout bug that saves the order before pricing runs, and the threshold itself must not pass, so **Inclusive** is off.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Greater Than |
| Field | `o_totalprice` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Value | `0` |
| Inclusive | Off |
| Numeric | *(none)* |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Checkout Engineering)* |
| Description | Order total must be greater than zero. |
| Tags | `orders`, `range` |
| Additional Metadata | `jira: DATA-8401` |
| Status | Active |

**Payload**

```json
{
    "description": "Order total must be greater than zero.",
    "rule": "greaterThan",
    "fields": ["o_totalprice"],
    "container_id": 145,
    "coverage": 1,
    "filter": null,
    "properties": {"value": 0, "inclusive": false},
    "tags": ["orders", "range"],
    "additional_metadata": {"jira": "DATA-8401"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}
```

**Sample Data**

| o_orderkey | o_totalprice | o_orderstatus |
| --- | --- | --- |
| 1 | 1840.50 | F |
| 2 | 0 | O |
| 3 | 220.00 | F |
| 4 | *(null)* | O |

**What gets flagged**

Order `2` holds exactly `0`. With **Inclusive** off the comparison is `> 0`, so the row fails. Order `4` is NULL and passes without firing an anomaly. Coverage is 100%, so the failing row is reported as a Record Anomaly.

> **Example: Record Anomaly**
>
> o_totalprice has the value 0, which is not greater than 0

**Flowchart**

```mermaid
graph TD
    A["No filter, evaluate all rows"] --> B["Read o_totalprice"]
    B --> C{"Is value NULL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E{"Is o_totalprice > 0?"}
    E -->|Yes| D
    E -->|No| F["Flag row.<br/>Record Anomaly per failing row."]
```

**Equivalent SQL**

```sql
-- Rows the Greater Than check would flag.
SELECT o.*
FROM orders o
WHERE o.o_totalprice IS NOT NULL
  AND o.o_totalprice <= 0;
```

**Tab: Inclusive Tenure with Filter**

**The situation:** Employees on the `permanent` contract qualify for an annual bonus once they reach 12 months of tenure. Exactly 12 months qualifies, so **Inclusive** is on. Temporary contracts are out of scope.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Greater Than |
| Field | `tenure_months` |
| Filter | `contract = 'permanent'` |
| Custom Anomaly Description | Off |
| Value | `12` |
| Inclusive | On |
| Numeric | *(none)* |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(People Analytics)* |
| Description | Permanent employees in the bonus pool must have at least 12 months of tenure. |
| Tags | `hr`, `eligibility` |
| Additional Metadata | `jira: DATA-8444` |
| Status | Active |

**Payload**

```json
{
    "description": "Permanent employees in the bonus pool must have at least 12 months of tenure.",
    "rule": "greaterThan",
    "fields": ["tenure_months"],
    "container_id": 512,
    "coverage": 1,
    "filter": "contract = 'permanent'",
    "properties": {"value": 12, "inclusive": true},
    "tags": ["hr", "eligibility"],
    "additional_metadata": {"jira": "DATA-8444"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 33
}
```

**Sample Data** (filtered to `contract = 'permanent'`)

| employee_id | contract | tenure_months |
| --- | --- | --- |
| E-01 | permanent | 36 |
| E-02 | permanent | 7 |
| E-03 | permanent | 12 |

**Why the filter matters**

The filter runs **before** the comparison, so temporary contracts are never tested against the tenure rule. Only permanent employees are evaluated.

**What gets flagged**

`E-02` has 7 months and does not qualify. `E-03` has exactly 12 and passes, because **Inclusive** is on. Coverage is 100%, so the failure is reported as a Record Anomaly, and the message names the filter that scoped the evaluation.

> **Example: Record Anomaly**
>
> tenure_months has the value 7, which is not greater than 12 (applied to records where contract = 'permanent')

**Flowchart**

```mermaid
graph TD
    A["Apply filter: contract = 'permanent'"] --> B["Read tenure_months"]
    B --> C{"Is tenure_months >= 12?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E["Flag row.<br/>Message names the filter:<br/>applied to records where contract = 'permanent'"]
```

**Equivalent SQL**

```sql
-- Rows the check would flag among permanent employees.
SELECT e.*
FROM employees e
WHERE e.contract = 'permanent'
  AND e.tenure_months IS NOT NULL
  AND e.tenure_months < 12;
```

**Tab: Reconciled Amount with Tolerance**

**The situation:** A reconciled `net_amount` must stay above a floor of 100, but the value accumulates rounding through several pipeline steps. A relative tolerance of 0.1% keeps that noise from firing while still catching real shortfalls. A cleanup is in progress, so the check tolerates up to 0.5% failures.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Greater Than |
| Field | `net_amount` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Value | `100` |
| Inclusive | On |
| Numeric | Relative, 0.001 |
| Coverage | 99.5% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Finance Data team)* |
| Description | Reconciled net amount must be at least 100, within rounding tolerance. |
| Tags | `finance`, `reconciliation` |
| Additional Metadata | `jira: DATA-8488` |
| Status | Active |

**Payload**

```json
{
    "description": "Reconciled net amount must be at least 100, within rounding tolerance.",
    "rule": "greaterThan",
    "fields": ["net_amount"],
    "container_id": 733,
    "coverage": 0.995,
    "filter": null,
    "properties": {"value": 100, "inclusive": true, "numeric_comparator": {"epsilon": 0.001, "as_absolute": false}},
    "tags": ["finance", "reconciliation"],
    "additional_metadata": {"jira": "DATA-8488"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 47
}
```

**Sample Data**

| settlement_id | net_amount | batch |
| --- | --- | --- |
| S-01 | 149.90 | B-1 |
| S-02 | 99.95 | B-1 |
| S-03 | 62.10 | B-2 |
| S-04 | 0 | B-2 |

**What gets flagged**

`S-02` is just under the floor but falls inside the 0.1% tolerance, so it passes. `S-03` and `S-04` miss by far more than the margin and fail. Only 50% of the rows pass, which is below the 99.5% coverage threshold, so the check reports a single Shape Anomaly for the dataset with a sample of the offending rows. Coverage below 100% does not produce Record Anomalies.

> **Example: Shape Anomaly**
>
> net_amount values are not greater than 100, affecting 2 of 4 asserted records

**Flowchart**

```mermaid
graph TD
    A["No filter, evaluate all rows"] --> B["Read net_amount"]
    B --> C{"Is value NULL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E["Add the 0.1% tolerance"]
    E --> F{"Is the adjusted value >= 100?"}
    F -->|Yes| D
    F -->|No| G["Flag row.<br/>Passing rate falls below the 99.5%<br/>coverage, so one Shape Anomaly is reported."]
```

**Equivalent SQL**

```sql
-- Rows the check would flag, allowing a 0.1% tolerance.
SELECT s.*
FROM settlements s
WHERE s.net_amount IS NOT NULL
  AND (s.net_amount + abs(s.net_amount) * 0.001) < 100;
```

## See Also

- **How It Works**

  The complete reference: definition, field scope, the threshold, inclusivity, the numeric comparator, NULL handling, filter behavior, and coverage.

  [How It Works](https://userguide.qualytics.io/data-quality-checks/greater-than/deep-dive/how-it-works/)
- **Anomaly Reporting**

  The anomaly messages the check produces, what the numbers mean, Source Records highlighting, and Custom Anomaly Description.

  [Anomaly Reporting](https://userguide.qualytics.io/data-quality-checks/greater-than/deep-dive/anomaly-reporting/)
- **Best Practices**

  Guidelines for setting the threshold, using inclusivity and tolerance, and keeping the signal clean.

  [Best Practices](https://userguide.qualytics.io/data-quality-checks/greater-than/deep-dive/best-practices/)
- **Permissions**

  The team permission each action needs: view, create, edit, archive, restore, and delete.

  [Permissions](https://userguide.qualytics.io/data-quality-checks/greater-than/deep-dive/permissions/)

*Last updated: September 22, 2026.*
