# Similar expecations overwriting one another

**URL:** <https://discourse.greatexpectations.io/t/similar-expecations-overwriting-one-another/1695>\
**Category:** GX Core Support\
**Created:** [April 9, 2024, 2:23pm UTC](https://discourse.greatexpectations.io/t/similar-expecations-overwriting-one-another/1695 "2024-04-09T14:23:09Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mike\_f50](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/mike_f50/32/169_2.png) [@mike\_f50](https://discourse.greatexpectations.io/u/mike_f50)\
**Post date:** [April 9, 2024, 2:23pm UTC](https://discourse.greatexpectations.io/t/similar-expecations-overwriting-one-another/1695/1 "2024-04-09T14:23:09Z")

</div>

I am building an expectation suite in python, and am coming across a few different scenarios where adding another expectation of the same type seems to overwrite an existing one.

**Example 1:** `expect_column_values_to_be_in_set` (different value\_sets for same column)

```py
cohorts = ["Cohort1","Cohort2","Cohort3"]

validator.expect_column_values_to_be_in_set(
    "Cohort",
    value_set=cohorts,
    meta={ "profiler_details": { "metric_configuration": { "metric_name": "cohort_in_approved_set" } } }
)
validator.expect_column_values_to_be_in_set(
    "Cohort",
    value_set={ "$PARAMETER": "urn:great_expectations:stores:sql_data_store:lookup_cohort_list" },
    meta={ "profiler_details": { "metric_configuration": { "metric_name": "cohort_configured_in_platform" } } }
)

```

In this example, the second expectation runs but not the first.

**Example 2:** `expect_table_row_count_to_be_between` (different row\_conditions)

```py
for cohort in cohorts:
    validator.expect_table_row_count_to_be_between(
        row_condition=f"Cohort==\"{cohort}\"",
        condition_parser='spark',
        min_value=get_min_expected_rows_for_cohort(cohort),
        max_value=get_max_expected_rows_for_cohort(cohort),
        meta={ "profiler_details": { "metric_configuration": { "metric_name": f"{cohort}_row_count" } } }
    )

```

In this example, the expecataion for `Cohort3` runs, but not the expectations for `Cohort1` or `Cohort2`.

Note that there doesn’t seem to be a fundamental issue with utilising the same expectation type multiple times, as demonstated below.

**Example 3:** `expect_column_values_to_be_in_set` (different row\_conditions and value\_sets)

```py
for cohort in cohorts:
    validator.expect_column_values_to_be_in_set(
        "Active",
        row_condition=f"Cohort==\"{cohort}\"",
        condition_parser='spark',
        value_set=[False],
        mostly=get_min_expected_inactive_for_cohort(cohort),
        meta={ "profiler_details": { "metric_configuration": { "metric_name": f"{cohort}_inactive" } } }
    )
    validator.expect_column_values_to_be_in_set(
        "Active",
        row_condition=f"Cohort==\"{cohort}\"",
        condition_parser='spark',
        value_set=[True],
        mostly=get_min_expected_active_for_cohort(cohort),
        meta={ "profiler_details": { "metric_configuration": { "metric_name": f"{cohort}_active" } } } )

```

Here, the second expectation runs _for each cohort_, but not the first - so I get 3 of the 6 expectations I was hoping for.

Perhaps what I’m trying to achieve is not possible (I know Conditional Expectations are experimental), but I’m hoping someone may be able to point me in the right direction.

---

_[View the full topic](https://discourse.greatexpectations.io/t/similar-expecations-overwriting-one-another/1695)._
