# Chaining expectations: many to many rules

**URL:** <https://discourse.greatexpectations.io/t/chaining-expectations-many-to-many-rules/1940>\
**Category:** GX Core Support\
**Created:** [October 10, 2024, 9:05am UTC](https://discourse.greatexpectations.io/t/chaining-expectations-many-to-many-rules/1940 "2024-10-10T09:05:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stelman](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@stelman](https://discourse.greatexpectations.io/u/stelman)\
**Post date:** [October 10, 2024, 9:05am UTC](https://discourse.greatexpectations.io/t/chaining-expectations-many-to-many-rules/1940/1 "2024-10-10T09:05:14Z")

</div>

Hello,

I have been looking into conditional expectations [Conditional Expectations | Great Expectations](https://legacy.017.docs.greatexpectations.io/docs/0.15.50/reference/expectations/conditional_expectations/)

This seems to follow a logic where an antecedent can have multiple rules, and a consequent 1 rule. That is, if an arbitrary number of conditions holds, then make sure that an expectation runs.

Would there be a way to trigger an AND condition of multiple expectations as well? E.g.

“if age \>25 and height \>190” THEN “expectation1 AND expectation2”

I have been looking into the docs, but I can’t figure out how to do that.

Thank you in advance,

---

<div class="post-metadata">

**Author:** ![adeola](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@adeola](https://discourse.greatexpectations.io/u/adeola)\
**Post date:** [October 18, 2024, 4:11pm UTC](https://discourse.greatexpectations.io/t/chaining-expectations-many-to-many-rules/1940/2 "2024-10-18T16:11:33Z")

</div>

hello there, welcome to our community!

We do not natively support combining expectations using logical operators directly. However, you can achieve this behavior through custom logic in your code by chaining validations together and checking the results.

Using your age example you could check that the ages in a column are less than 25 and the weight less than 190 and use the result to check if the validation passes, and then use an if statement to trigger more expectations. Example:

```auto
age = df.expect_column_values_to_be_between(column="age", min_value=25)
height = df.expect_column_values_to_be_between(column="weight", min_value=190)

```

`if age["success"] and weight["success"]:`  
`next_expectation = ...`
