Between Check Examples
Three real-world scenarios that show how the Between check is typically used in production: validating a discount ratio, enforcing a contract amount band with a filter, and catching implausible sensor readings. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.
The situation: The lineitem table stores l_discount as a ratio. Any value below 0 or above 1 means the pricing engine wrote a percentage (or a negative correction) into a ratio column, which silently distorts every revenue calculation downstream. Both 0 (no discount) and 1 (fully discounted) are legitimate, so both boundaries are inclusive.
Check configuration
| Field | Value |
|---|---|
| Rule | Between |
| Field | l_discount |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Min | 0 (Inclusive) |
| Max | 1 (Inclusive) |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Pricing Engineering) |
| Description | Discount must be a ratio between 0 and 1, inclusive. |
| Tags | pricing, range |
| Additional Metadata | jira: DATA-6021 |
| Status | Active |
Payload
{
"description": "Discount must be a ratio between 0 and 1, inclusive.",
"rule": "between",
"fields": ["l_discount"],
"container_id": 214,
"coverage": 1,
"filter": null,
"properties": {
"min": 0,
"inclusive_min": true,
"max": 1,
"inclusive_max": true
},
"tags": ["pricing", "range"],
"additional_metadata": {"jira": "DATA-6021"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 12
}
Sample Data
| l_orderkey | l_discount | l_extendedprice |
|---|---|---|
| 1001 | 0.05 | 1840.00 |
| 1002 | 15 | 920.00 |
| 1003 | 0 | 640.00 |
| 1004 | 1 | 75.00 |
What gets flagged
Line 1002 holds 15, a percentage written into a ratio column. Lines with 0 and 1 sit exactly on the boundaries and pass, because both sides are inclusive. Coverage is 100%, so the failing row is reported as a Record Anomaly.
Record Anomaly
The field 'l_discount' has value 15, which is not between 0.000 and 1.000
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read l_discount"]
B --> C{"Is l_discount >= 0<br/>AND <= 1?"}
C -->|Yes| D["Row passes"]
C -->|No| E["Flag row.<br/>Record Anomaly per failing row."]
Equivalent SQL
The situation: Contracts on the standard tier must be worth more than 1,000 and at most 50,000. Below the floor they should have gone through self-service, above the ceiling they need an enterprise approval. The floor is exclusive (exactly 1,000 belongs to self-service) and the ceiling is inclusive (exactly 50,000 is still standard). Other tiers are out of scope.
Check configuration
| Field | Value |
|---|---|
| Rule | Between |
| Field | contract_value |
| Filter | tier = 'standard' |
| Custom Anomaly Description | Off |
| Min | 1000 (Exclusive) |
| Max | 50000 (Inclusive) |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Revenue Operations) |
| Description | Standard-tier contracts must be above 1,000 and at most 50,000. |
| Tags | contracts, range |
| Additional Metadata | jira: DATA-6104 |
| Status | Active |
Payload
{
"description": "Standard-tier contracts must be above 1,000 and at most 50,000.",
"rule": "between",
"fields": ["contract_value"],
"container_id": 640,
"coverage": 1,
"filter": "tier = 'standard'",
"properties": {
"min": 1000,
"inclusive_min": false,
"max": 50000,
"inclusive_max": true
},
"tags": ["contracts", "range"],
"additional_metadata": {"jira": "DATA-6104"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 26
}
Sample Data (filtered to tier = 'standard')
| contract_id | tier | contract_value |
|---|---|---|
| C-4001 | standard | 12500 |
| C-4002 | standard | 1000 |
| C-4003 | standard | 50000 |
Why the filter matters
The filter runs before the comparison, so enterprise and self-service contracts are never tested against the standard band. Only standard-tier rows are evaluated.
What gets flagged
C-4002 is exactly 1000, and the lower boundary is exclusive, so the row fails. C-4003 is exactly 50000 and passes, because the upper boundary is inclusive. 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 'contract_value' has value 1000, which is not between 1000.000 and 50000.000 [filter: tier = 'standard']
Flowchart
graph TD
A["Apply filter: tier = 'standard'"] --> B["Read contract_value"]
B --> C{"Is contract_value > 1000<br/>AND <= 50000?"}
C -->|Yes| D["Row passes"]
C -->|No| E["Flag row.<br/>Anomaly message ends with<br/>[filter: tier = 'standard']"]
Equivalent SQL
The situation: A fleet of temperature sensors reports into sensor_readings. Physically valid values sit between -40 and 85 degrees Celsius, the operating range of the hardware. A small fraction of readings is expected to be out of range while faulty units are being replaced, so the check tolerates up to 0.5% failures. Sensors that failed to report leave the value NULL.
Check configuration
| Field | Value |
|---|---|
| Rule | Between |
| Field | temperature_c |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Min | -40 (Inclusive) |
| Max | 85 (Inclusive) |
| Coverage | 99.5% |
| Owner | (check creator) |
| Anomaly Assignee | (Fleet Telemetry) |
| Description | Sensor readings must fall inside the hardware operating range. |
| Tags | telemetry, plausibility |
| Additional Metadata | jira: DATA-6233 |
| Status | Active |
Payload
{
"description": "Sensor readings must fall inside the hardware operating range.",
"rule": "between",
"fields": ["temperature_c"],
"container_id": 733,
"coverage": 0.995,
"filter": null,
"properties": {
"min": -40,
"inclusive_min": true,
"max": 85,
"inclusive_max": true
},
"tags": ["telemetry", "plausibility"],
"additional_metadata": {"jira": "DATA-6233"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 52
}
Sample Data
| reading_id | temperature_c | sensor_id |
|---|---|---|
| R-8801 | 21.4 | S-12 |
| R-8802 | -273.15 | S-19 |
| R-8803 | 999 | S-19 |
| R-8804 | (null) | S-27 |
What gets flagged
Readings R-8802 and R-8803 come from the same faulty unit and fall far outside the hardware range. R-8804 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 'temperature_c', 50.000% of 4 records (2) are not between -40.000 and 85.000
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read temperature_c"]
B --> C{"Is value NULL?"}
C -->|Yes| D["Row passes"]
C -->|No| E{"Is temperature_c >= -40<br/>AND <= 85?"}
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, properties, boundary inclusivity, NULL handling, 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 boundaries, setting inclusivity, pairing rules, and keeping the signal clean.
-
Permissions
The team permission each action needs: view, create, edit, archive, restore, and delete.