# Max Value Check Examples

Source: https://userguide.qualytics.io/data-quality-checks/max-value/deep-dive/examples/

Three real-world scenarios that show how the Max Value check is typically used in production: capping a discount percentage, enforcing a per-tier credit limit with a filter, and catching implausible quantities. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.

**Tab: Discount Ceiling**

**The situation:** The `orders` table stores the applied discount as a percentage in `discount_pct`. Anything above 100 means the pricing engine wrote a raw amount into a percentage column, which produces negative revenue downstream. Exactly 100 is a legitimate full discount.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Max Value |
| Field | `discount_pct` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Value | `100` |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Pricing Engineering)* |
| Description | Discount percentage must not exceed 100. |
| Tags | `pricing`, `range` |
| Additional Metadata | `jira: DATA-8001` |
| Status | Active |

**Payload**

```json
{
    "description": "Discount percentage must not exceed 100.",
    "rule": "maxValue",
    "fields": ["discount_pct"],
    "container_id": 145,
    "coverage": 1,
    "filter": null,
    "properties": {"value": 100},
    "tags": ["pricing", "range"],
    "additional_metadata": {"jira": "DATA-8001"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}
```

**Sample Data**

| order_id | discount_pct | channel |
| --- | --- | --- |
| O-001 | 15 | web |
| O-002 | 2500 | web |
| O-003 | 100 | partner |
| O-004 | *(null)* | web |

**What gets flagged**

Order `O-002` holds `2500`, an amount written into a percentage column. `O-003` is exactly `100` and passes, because the ceiling is inclusive. `O-004` is NULL and passes without firing an anomaly. Coverage is 100%, so the failing row is reported as a Record Anomaly.

> **Example: Record Anomaly**
>
> discount_pct has the value 2500, which is above the maximum of 100

**Flowchart**

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

**Equivalent SQL**

```sql
-- Rows the Max Value check would flag.
SELECT o.*
FROM orders o
WHERE o.discount_pct IS NOT NULL
  AND o.discount_pct > 100;
```

**Tab: Credit Limit by Tier, with Filter**

**The situation:** Standard-tier accounts may not carry a credit limit above 50,000; higher tiers have their own ceilings and are out of scope for this check.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Max Value |
| Field | `credit_limit` |
| Filter | `tier = 'standard'` |
| Custom Anomaly Description | Off |
| Value | `50000` |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Risk Operations)* |
| Description | Standard-tier credit limit must not exceed 50,000. |
| Tags | `risk`, `range` |
| Additional Metadata | `jira: DATA-8044` |
| Status | Active |

**Payload**

```json
{
    "description": "Standard-tier credit limit must not exceed 50,000.",
    "rule": "maxValue",
    "fields": ["credit_limit"],
    "container_id": 640,
    "coverage": 1,
    "filter": "tier = 'standard'",
    "properties": {"value": 50000},
    "tags": ["risk", "range"],
    "additional_metadata": {"jira": "DATA-8044"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 26
}
```

**Sample Data** (filtered to `tier = 'standard'`)

| account_id | tier | credit_limit |
| --- | --- | --- |
| A-4001 | standard | 12000 |
| A-4002 | standard | 75000 |
| A-4003 | standard | 50000 |

**Why the filter matters**

The filter runs **before** the comparison, so enterprise accounts are never tested against the standard ceiling. Only standard-tier rows are evaluated.

**What gets flagged**

`A-4002` carries a limit above the standard ceiling, probably a tier change that was never applied to the account record. `A-4003` sits exactly on the ceiling and passes. 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**
>
> credit_limit has the value 75000, which is above the maximum of 50,000 (applied to records where tier = 'standard')

**Flowchart**

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

**Equivalent SQL**

```sql
-- Rows the check would flag on the standard tier.
SELECT a.*
FROM accounts a
WHERE a.tier = 'standard'
  AND a.credit_limit IS NOT NULL
  AND a.credit_limit > 50000;
```

**Tab: Implausible Quantities**

**The situation:** A warehouse feed writes line quantities into `quantity`. No single line can legitimately exceed 10,000 units. A faulty integration is producing a few oversized rows while it is being fixed, so the check tolerates up to 0.5% failures.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Max Value |
| Field | `quantity` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Value | `10000` |
| Coverage | 99.5% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Warehouse Integrations)* |
| Description | Line quantity must not exceed 10,000 units. |
| Tags | `inventory`, `plausibility` |
| Additional Metadata | `jira: DATA-8090` |
| Status | Active |

**Payload**

```json
{
    "description": "Line quantity must not exceed 10,000 units.",
    "rule": "maxValue",
    "fields": ["quantity"],
    "container_id": 733,
    "coverage": 0.995,
    "filter": null,
    "properties": {"value": 10000},
    "tags": ["inventory", "plausibility"],
    "additional_metadata": {"jira": "DATA-8090"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 52
}
```

**Sample Data**

| line_id | quantity | source |
| --- | --- | --- |
| L-01 | 120 | wms |
| L-02 | 1000000 | legacy-edi |
| L-03 | 45000 | legacy-edi |
| L-04 | *(null)* | wms |

**What gets flagged**

Lines `L-02` and `L-03` come from the faulty integration and exceed the ceiling. `L-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.

> **Example: Shape Anomaly**
>
> quantity values are above the maximum of 10,000, affecting 2 of 4 asserted records

**Flowchart**

```mermaid
graph TD
    A["No filter, evaluate all rows"] --> B["Read quantity"]
    B --> C{"Is value NULL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E{"Is quantity <= 10000?"}
    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**

```sql
-- Rows the check would flag.
SELECT l.*
FROM order_lines l
WHERE l.quantity IS NOT NULL
  AND l.quantity > 10000;
```

## See Also

- **How It Works**

  The complete reference: definition, field scope, the ceiling property, NULL handling, arrays, filter behavior, and coverage.

  [How It Works](https://userguide.qualytics.io/data-quality-checks/max-value/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/max-value/deep-dive/anomaly-reporting/)
- **Best Practices**

  Guidelines for choosing the ceiling, pairing rules, and keeping the signal clean.

  [Best Practices](https://userguide.qualytics.io/data-quality-checks/max-value/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/max-value/deep-dive/permissions/)

*Last updated: September 22, 2026.*
