Niels van Beem
06/30/2025, 9:25 AMkapa.ai
06/30/2025, 9:25 AMkapa.ai
06/30/2025, 9:25 AMelementary.dimension_anomalies test. This test is specifically designed to monitor the frequency of values in a configured dimension (column) over time and alert on unexpected changes in the distribution. It is best used on low-cardinality fields like gender [Add anomaly detection tests](https://docs.elementary-data.com/data-tests/add-elementary-tests). Example configuration: yaml models: - name: your_model tests: - elementary.dimension_anomalies: dimensions: - gender meta: owner: loyalty description: Detects sudden anomalies in the distribution for gender ### Adding Multiple Distribution Tests on One Table If you want to check the distribution for multiple columns (e.g., gender, country), you should define a separate elementary.dimension_anomalies test for each column. Do not list multiple dimensions in a single test if you want to monitor them independently, as this will combine the dimensions and check the joint distribution (e.g., gender + country), not each separately. Here’s how to do it: yaml models: - name: your_model tests: - elementary.dimension_anomalies: dimensions: - gender meta: owner: loyalty description: Detects sudden anomalies in the distribution for gender - elementary.dimension_anomalies: dimensions: - country meta: owner: loyalty description: Detects sudden anomalies in the distribution for country This way, each test is uniquely defined and dbt will not throw an error about duplicate test names. If you want to further distinguish tests (e.g., for different configurations on the same column), you can use the alias or name parameter to give each test a unique identifier. ### Summary - Use elementary.dimension_anomalies for value frequency/distribution checks. - Define a separate test for each column you want to monitor. - Use alias or name if you need multiple tests on the same column with different configs. - Do not list multiple dimensions in one test unless you want to check the joint distribution. For more details, see the official documentation and community guidance [here](https://docs.elementary-data.com/data-tests/add-elementary-tests) and [here](https://slack.com/archives/C02CTC89LAX/p1668437656150669).