Documentation Index
Fetch the complete documentation index at: https://elementary-devin-1774320697-fabric-cloud-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Generate your anomaly test with Elementary AI
Let our Slack chatbot create the anomaly test you need.
elementary.volume_threshold
Monitors row count changes between time buckets using configurable percentage thresholds with multiple severity levels.
Unlike volume_anomalies (which uses z-score based anomaly detection as a dbt test, or ML-based detection in Elementary Cloud), this test lets you define explicit percentage thresholds for warnings and errors, giving you precise control over when to be alerted. It uses Elementary’s metric caching infrastructure to avoid recalculating row counts for buckets that have already been computed.
Use Case
“Alert me if my table’s row count drops or spikes by more than 10% compared to the previous period.”Test Logic
- Collect row count metrics per time bucket (using Elementary’s incremental metric caching)
- Compare the most recent completed bucket against the previous bucket
- Calculate the percentage change between the two
- If the previous bucket has fewer rows than
min_row_count→ PASS (insufficient baseline) - If the absolute change exceeds
error_threshold_percent→ ERROR - If the absolute change exceeds
warn_threshold_percent→ WARN - Otherwise → PASS
Test configuration
Required configuration:timestamp_column
data_tests:
— elementary.volume_threshold:
arguments:
timestamp_column: column name # Required
warn_threshold_percent: int # Optional - default: 5
error_threshold_percent: int # Optional - default: 10
direction: [both | spike | drop] # Optional - default: both
time_bucket: # Optional
period: [hour | day | week | month]
count: int
where_expression: sql expression # Optional
days_back: int # Optional - default: 14
backfill_days: int # Optional - default: 2
min_row_count: int # Optional - default: 100
Features
- Dual severity levels: Separate thresholds for warnings and errors, giving you graduated alerting
- Directional monitoring: Choose to monitor
bothdirections, onlyspike(increases), or onlydrop(decreases) - Incremental metric caching: Uses Elementary’s
data_monitoring_metricstable to avoid recalculating row counts for previously computed time buckets - Minimum baseline protection: The
min_row_countparameter prevents false alerts when the baseline is too small - Configurable time buckets: Works with hourly, daily, weekly, or monthly buckets
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
timestamp_column | Yes | - | Column to determine time periods |
warn_threshold_percent | No | 5 | Percentage change that triggers a warning |
error_threshold_percent | No | 10 | Percentage change that triggers an error |
direction | No | both | Direction to monitor: both, spike, or drop |
time_bucket | No | {period: day, count: 1} | Time bucket configuration |
where_expression | No | - | SQL expression to filter the data |
days_back | No | 14 | Days of metric history to retain |
backfill_days | No | 2 | Days to recalculate on each run |
min_row_count | No | 100 | Minimum rows in the previous bucket required to trigger the check |
Comparison with volume_anomalies
| Feature | volume_threshold | volume_anomalies |
|---|---|---|
| Detection method | Fixed percentage thresholds | Z-score (dbt test) / ML (Cloud) |
| Severity levels | Dual (warn + error) | Single (pass/fail) |
| Best for | Known acceptable ranges | Unknown/variable patterns |
| Configuration | Explicit thresholds | Sensitivity tuning |
| Baseline | Previous bucket | Training period average |
How severity levels work
This test has built-in dual severity using dbt’swarn_if / error_if config. You do not need to set config.severity yourself. The behavior is:
- Change exceeds
warn_threshold_percentbut noterror_threshold_percent→ dbt warning - Change exceeds
error_threshold_percent→ dbt error (test fails) - Change is below
warn_threshold_percent→ pass
warn_threshold_percent: 3 and error_threshold_percent: 8:
- A 2% drop → pass
- A 5% drop → warning
- A 10% drop → error
Notes
- The
warn_threshold_percentmust be less than or equal toerror_threshold_percent - The test uses Elementary’s metric caching infrastructure. Row counts for previously computed time buckets are reused across runs
- If the previous bucket has fewer rows than
min_row_count, the test passes (insufficient data for a meaningful comparison) - The test only evaluates completed time buckets

