Ninad Thorat
08/19/2025, 10:37 AMkapa.ai
08/19/2025, 10:37 AMkapa.ai
08/19/2025, 10:38 AMNinad Thorat
08/19/2025, 10:40 AMkapa.ai
08/19/2025, 10:40 AMkapa.ai
08/19/2025, 10:40 AManomaly_exclude_metrics parameter. This parameter allows you to specify a SQL where expression to filter out certain data points from the training set, so they do not influence future anomaly detection. Example: Suppose you want to exclude any data point where the row count (metric_value) is less than 10 (which might indicate a truncate event), you can configure your test like this: yaml models: - name: your_model_name tests: - elementary.volume_anomalies: anomaly_exclude_metrics: metric_value < 10 Alternatively, if you know the exact date or time bucket when the truncate-and-load event happened, you can exclude that specific period: yaml models: - name: your_model_name tests: - elementary.volume_anomalies: anomaly_exclude_metrics: metric_date = '2024-06-01' Or, for a specific time range: yaml models: - name: your_model_name tests: - elementary.volume_anomalies: anomaly_exclude_metrics: metric_time_bucket >= '2024-06-01 00:00:00' and metric_time_bucket <= '2024-06-01 23:59:59' How it works: The anomaly_exclude_metrics filter removes the specified data points from the training set, so they do not affect the calculation of expected values in future runs. This is especially useful for truncate-and-load tables, where you want to ignore the periods with zero or very low row counts due to the load process. For more details and examples, see the official documentation: [anomaly_exclude_metrics](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/anomaly-exclude-metrics) and related discussions [GitHub Issue #1491](https://github.com/elementary-data/elementary/issues/1491) and [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1729524423351429).