expect_column_median_to_be_between

Feb 24, 2026

·

5

min read

Values distribution

·

dbt-expectations

·

Column

How it Works

The expect_column_median_to_be_between test from the dbt-expectations package validates that the median (50th percentile) of a numeric column's values falls within a defined range. The median is more robust to outliers than the mean, making this test preferable when data may contain extreme values that would distort a mean-based check.

Optional arguments include group_by, row_condition, and strictly.

Steps and Conditions

  1. Column Selection: Choose the numeric column to evaluate.

  2. Define Range: Set min_value and/or max_value for acceptable median values.

  3. Optional Config: Apply group_by, row_condition, and strictly as needed.

  4. Execution: The median is computed and compared to the range.

  5. Outcome: Pass if within range; fail otherwise.

Example Usage: Real Estate Analytics

A real estate analytics platform tracks property valuations and wants to ensure the median property price stays within an expected market range.

models:
  - name: property_listings
    columns:
      - name: listing_price_usd
        tests:
          - dbt_expectations.expect_column_median_to_be_between:
              min_value: 150000
              max_value: 2000000
models:
  - name: property_listings
    columns:
      - name: listing_price_usd
        tests:
          - dbt_expectations.expect_column_median_to_be_between:
              min_value: 150000
              max_value: 2000000
models:
  - name: property_listings
    columns:
      - name: listing_price_usd
        tests:
          - dbt_expectations.expect_column_median_to_be_between:
              min_value: 150000
              max_value: 2000000

A median outside this range could indicate a data ingestion error, a market segment misclassification, or a currency conversion issue.

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.