<@U088WCP3B4P> I want a test which can spot if a v...
# ask-elementary-ai
j
@kapa.ai I want a test which can spot if a value has dropped by 25%. This is from an event table so would need to be detecting anomalies grouped by multiple columns. Which test should I use? Give me the elementary config
k
Based on your requirements — detecting a 25% drop in values, grouped by multiple columns — you should use
elementary.dimension_anomalies
(if you want to monitor row counts per dimension) or
elementary.column_anomalies
(if you want to monitor a specific metric column, like a sum or count, grouped by dimensions). Given you're working with an event table and want grouping by multiple columns, here's how to configure each option: Option 1: dimension_anomalies (monitors row counts grouped by dimensions)
Copy code
models:
  - name: your_event_table
    config:
      elementary:
        timestamp_column: event_timestamp
    data_tests:
      - elementary.dimension_anomalies:
          config:
            severity: warn
          arguments:
            dimensions:
              - event_type
              - country_code
            anomaly_direction: drop
            ignore_small_changes:
              drop_failure_percent_threshold: 25
            time_bucket:
              period: day
              count: 1
[dimension_anomalies config] Option 2: column_anomalies (monitors a specific metric column, grouped by dimensions)
Copy code
models:
  - name: your_event_table
    config:
      elementary:
        timestamp_column: event_timestamp
    columns:
      - name: event_value
        data_tests:
          - elementary.column_anomalies:
              arguments:
                column_anomalies:
                  - sum
                dimensions:
                  - event_type
                  - country_code
                anomaly_direction: drop
                ignore_small_changes:
                  drop_failure_percent_threshold: 25
                time_bucket:
                  period: day
                  count: 1
[column_anomalies config; dimensions config] Key points: •
ignore_small_changes.drop_failure_percent_threshold: 25
ensures the test only fails if the value drops by more than 25% compared to the historical mean — this works in addition to the z-score anomaly check. [ignore_small_changes] •
dimensions
segments the detection so each unique combination of column values (e.g.,
event_type='click'
+
country_code='US'
) is monitored independently. [dimensions config] • It's recommended to use low-cardinality fields as dimensions to avoid performance issues. • Use
dimension_anomalies
if you care about row count distribution; use
column_anomalies
if you want to monitor a specific numeric metric (e.g., sum of revenue). 👍 0 button 👎 0 button ℹ️ Tip: Mention @elementary.ai in the thread for follow-ups or DM the app for 1-to-1 help.