Not Negative Check Examples
Three real-world scenarios that show how the Not Negative check is typically used in production: guarding account balances, validating stock levels with a filter, and auditing a legacy measure mid-cleanup. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.
The situation: Prepaid accounts cannot go below zero: the platform blocks a charge that would overdraw them. A negative balance therefore means a settlement job ran twice or applied a charge out of order. Zero is perfectly valid.
Check configuration
| Field | Value |
|---|---|
| Rule | Not Negative |
| Field | balance |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Payments Engineering) |
| Description | Prepaid account balance must not be negative. |
| Tags | finance, range |
| Additional Metadata | jira: DATA-8301 |
| Status | Active |
Payload
{
"description": "Prepaid account balance must not be negative.",
"rule": "notNegative",
"fields": ["balance"],
"container_id": 145,
"coverage": 1,
"filter": null,
"properties": {},
"tags": ["finance", "range"],
"additional_metadata": {"jira": "DATA-8301"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 12
}
Sample Data
| account_id | balance | plan |
|---|---|---|
| A-001 | 120.50 | prepaid |
| A-002 | 0.00 | prepaid |
| A-003 | -45.00 | prepaid |
| A-004 | (null) | prepaid |
What gets flagged
Account A-003 carries a negative balance, which the platform should never allow. A-002 holds zero and passes, because Not Negative accepts zero. A-004 is NULL and passes without firing an anomaly. Coverage is 100%, so the failing row is reported as a Record Anomaly.
Record Anomaly
The field 'balance' has value -45.00, which is a negative number
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read balance"]
B --> C{"Is value NULL?"}
C -->|Yes| D["Row passes"]
C -->|No| E{"Is balance >= 0?"}
E -->|Yes| D
E -->|No| F["Flag row.<br/>Record Anomaly per failing row."]
Equivalent SQL
The situation: Warehouses that do not allow backorders must never report a negative stock level. Warehouses configured for backorders legitimately go negative and are excluded with a filter.
Check configuration
| Field | Value |
|---|---|
| Rule | Not Negative |
| Field | on_hand |
| Filter | allows_backorder = false |
| Custom Anomaly Description | Off |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Inventory Operations) |
| Description | Stock levels must not be negative where backorders are disabled. |
| Tags | inventory, range |
| Additional Metadata | jira: DATA-8344 |
| Status | Active |
Payload
{
"description": "Stock levels must not be negative where backorders are disabled.",
"rule": "notNegative",
"fields": ["on_hand"],
"container_id": 512,
"coverage": 1,
"filter": "allows_backorder = false",
"properties": {},
"tags": ["inventory", "range"],
"additional_metadata": {"jira": "DATA-8344"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 29
}
Sample Data (filtered to allows_backorder = false)
| sku | allows_backorder | on_hand |
|---|---|---|
| SKU-01 | false | 42 |
| SKU-02 | false | -7 |
| SKU-03 | false | 0 |
Why the filter matters
The filter runs before the comparison, so warehouses that allow backorders are never tested. Only rows where a negative level is impossible are evaluated.
What gets flagged
SKU-02 shows a negative level in a warehouse that cannot backorder, which points at a double-counted shipment. SKU-03 holds zero and passes. Coverage is 100%, so the failure is reported as a Record Anomaly, and the message ends with the filter that scoped the evaluation.
Record Anomaly
The field 'on_hand' has value -7, which is a negative number [filter: allows_backorder = false]
Flowchart
graph TD
A["Apply filter: allows_backorder = false"] --> B["Read on_hand"]
B --> C{"Is on_hand >= 0?"}
C -->|Yes| D["Row passes"]
C -->|No| E["Flag row.<br/>Anomaly message ends with<br/>[filter: allows_backorder = false]"]
Equivalent SQL
The situation: A legacy import writes days_open with occasional negative values produced by a broken date subtraction. A fix is rolling out, so a small fraction of bad rows is expected and the check tolerates up to 0.5% failures.
Check configuration
| Field | Value |
|---|---|
| Rule | Not Negative |
| Field | days_open |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Coverage | 99.5% |
| Owner | (check creator) |
| Anomaly Assignee | (Support Analytics) |
| Description | Days open must not be negative. |
| Tags | support, plausibility |
| Additional Metadata | jira: DATA-8388 |
| Status | Active |
Payload
{
"description": "Days open must not be negative.",
"rule": "notNegative",
"fields": ["days_open"],
"container_id": 733,
"coverage": 0.995,
"filter": null,
"properties": {},
"tags": ["support", "plausibility"],
"additional_metadata": {"jira": "DATA-8388"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 52
}
Sample Data
| ticket_id | days_open | source |
|---|---|---|
| T-01 | 4 | portal |
| T-02 | -2 | legacy |
| T-03 | -15 | legacy |
| T-04 | (null) | legacy |
What gets flagged
Tickets T-02 and T-03 come from the legacy import with negative durations. T-04 is NULL, so it passes without firing an anomaly but still counts in the scanned total. 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.
Shape Anomaly
For the field 'days_open', 50.000% of 4 records (2) contain negative numbers
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read days_open"]
B --> C{"Is value NULL?"}
C -->|Yes| D["Row passes"]
C -->|No| E{"Is days_open >= 0?"}
E -->|Yes| D
E -->|No| F["Flag row.<br/>Passing rate falls below the 99.5%<br/>coverage, so one Shape Anomaly is reported."]
Equivalent SQL
See Also
-
How It Works
The complete reference: definition, field scope, the comparison, NULL handling, arrays, filter behavior, and coverage.
-
Anomaly Reporting
The anomaly messages the check produces, what the numbers mean, Source Records highlighting, and Custom Anomaly Description.
-
Best Practices
Guidelines for choosing between the sign rules, pairing them, and keeping the signal clean.
-
Permissions
The team permission each action needs: view, create, edit, archive, restore, and delete.