expect_column_values_to_be_within_n_stdevs

Feb 24, 2026

·

5

min read

Anomaly detection, Values distribution

·

dbt-expectations

·

Column

How it Works

The expect_column_values_to_be_within_n_stdevs test from the dbt-expectations package validates that every value in a column is within a specified number of standard deviations from the overall column mean. This is a static outlier detection check, contrasted with the moving-window variant expect_column_values_to_be_within_n_moving_stdevs.

The n_sigmas argument defines how many standard deviations from the mean are considered acceptable.

Steps and Conditions

  1. Column Selection: Identify the numeric column to monitor.

  2. Set Sensitivity: Define n_sigmas for acceptable deviation.

  3. Execution: The mean and standard deviation are computed; each value is checked against the derived bounds.

  4. Outcome: Pass if all values are within bounds; fail if outliers are found.

Example Usage: Fraud Detection

A fraud detection team wants to flag any transaction amounts that are more than 4 standard deviations from the mean for a given day, which could indicate fraudulent outliers.

models:
  - name: daily_transactions
    columns:
      - name: amount_usd
        tests:
          - dbt_expectations.expect_column_values_to_be_within_n_stdevs:
              group_by: [transaction_date]
              n_sigmas: 4
models:
  - name: daily_transactions
    columns:
      - name: amount_usd
        tests:
          - dbt_expectations.expect_column_values_to_be_within_n_stdevs:
              group_by: [transaction_date]
              n_sigmas: 4
models:
  - name: daily_transactions
    columns:
      - name: amount_usd
        tests:
          - dbt_expectations.expect_column_values_to_be_within_n_stdevs:
              group_by: [transaction_date]
              n_sigmas: 4

Exceptionally large or small transaction amounts that fall outside 4 standard deviations are surfaced for fraud review.

Interested to Learn More?
Try Out the Free 14-Days Trial

More Articles

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

decorative icon

Experience Analytics for the AI-Era

Start your 14-day trial today - it's free and no credit card needed

Copyright © 2026 Paradime Labs, Inc.

Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.

Copyright © 2026 Paradime Labs, Inc.

Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.

Copyright © 2026 Paradime Labs, Inc.

Made with ❤️ in San Francisco ・ London

*dbt® and dbt Core® are federally registered trademarks of dbt Labs, Inc. in the United States and various jurisdictions around the world. Paradime is not a partner of dbt Labs. All rights therein are reserved to dbt Labs. Paradime is not a product or service of or endorsed by dbt Labs, Inc.