> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elementary-data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# anomaly_direction

<Card title="Generate your anomaly test with Elementary AI" icon="wand-magic-sparkles" horizontal="true" href="https://elementary-data.com/community">
  Let our Slack chatbot create the anomaly test you need.
</Card>

`anomaly_direction: both | spike | drop`

By default, data points are compared to the expected range and check if these are below or above it.
For some data monitors, you might only want to flag anomalies if they are above the range and not under it, and vice versa.
For example - when monitoring for freshness, we only want to detect data delays and not data that is “early”.
The anomaly\_direction configuration is used to configure the direction of the expected range, and can be set to both, spike or drop.

* *Default: `both`*
* *Supported values: `both`, `spike`, `drop`*
* *Relevant tests: All anomaly detection tests*

<Frame caption="anomaly_direction change impact">
  <img src="https://res.cloudinary.com/diuctyblm/image/upload/v1681301375/Anomaly%20detection%20tests/anomaly_direction_r1sdl9.png" alt="anomaly_direction change impact" />
</Frame>

<RequestExample>
  ```yml test theme={null}
  models:
    - name: this_is_a_model
      data_tests:
        - elementary.volume_anomalies:
            arguments:
              anomaly_direction: drop

        - elementary.all_columns_anomalies:
            arguments:
              column_anomalies:
                - null_count
                - missing_count
                - zero_count
              anomaly_direction: spike
  ```

  ```yml model theme={null}
  models:
    - name: this_is_a_model
      config:
        elementary:
          anomaly_direction: drop
  ```

  ```yml dbt_project theme={null}
  vars:
    anomaly_direction: both
  ```
</RequestExample>
