Segments

Boolean segment composition

6 min read
segments · win-back-30
Lapsed 30 days
warehouse · refresh 1h
12,904
Power users
zero-copy · refresh 5m
48,120
Key takeaways
  • Boolean segment composition builds an audience from real logic: match ANY of a set of conditions, match ALL of them, or exclude with NOT.
  • Range operators (greater than, less than, between) work on warehouse predicates, so conditions are not limited to equals.
  • The composition is pure and property-tested, proving that flat AND-only definitions compile to exactly the same audience as before.
  • It builds on model-driven segments, so precise logic sits on top of audiences you still describe in plain concepts.
Match ANYOR
Match ALLAND
ExcludeNOT
Precise audience
Compose audiences with AND, OR, and NOT.

Boolean segment composition is the ability to build an audience from real logic: match ANY of a set of conditions (OR), match ALL of them (AND), and exclude anyone who fits a condition (NOT). It is how you say exactly who you mean.

Most audiences are more than a single filter. You want the people who did one thing and not another, or who match any of several signals. Composition lets you express that precisely, layered on top of the model-driven segments you already describe in plain language.

Match ANY, match ALL, and exclude

Three operators cover almost everything you need. ALL (AND) narrows, because every condition must hold. ANY (OR) widens, because any one condition is enough. NOT removes, dropping anyone who matches the excluded condition even if they matched the rest.

  • ALL / AND: active in the last 30 days and a paying subscriber.
  • ANY / OR: opened the app, or clicked an email, or made a purchase.
  • NOT: everything above, except anyone already in the win-back journey.

Combine the three and you can describe audiences that a single flat filter simply cannot reach.

The operators also nest, which is where the real precision comes from. An ALL group can contain an ANY group, so a paying subscriber who also opened the app or clicked an email is one audience rather than three you union by hand. Grouping turns a flat checklist into the exact shape you have in mind.

Range operators on warehouse predicates

Conditions are not limited to equals. Predicates on your warehouse support range operators: greater than, less than, and between. So sessions greater than 10, last active less than 7 days ago, or lifetime value between two amounts are all first-class conditions you can drop into an ANY, ALL, or NOT group.

Because these run as predicates against your mapped data, they read the same real columns your connected sources expose through the semantic model.

Ranges matter because most real audiences live in a band, not at a single value. Members with more than 10 sessions but fewer than 100 behave differently from either extreme, and a range names that middle directly. Each operator resolves to a predicate the compiler runs against your warehouse, so the logic stays close to the data.

A worked example

Here is the audience power users active in the last 30 days, but not already in the win-back journey, written as a composed definition:

{
  "logic": "AND",
  "conditions": [
    { "role": "segment", "eq": "power_users" },
    { "role": "last_active", "op": "lt", "value": "30d" }
  ],
  "exclude": [
    { "role": "journey", "negate": true, "eq": "win_back" }
  ]
}

The AND block narrows to active power users, and the exclude block with negate drops anyone already enrolled in win-back. One definition, precise on both sides. Swap the AND for an OR, or add another exclusion, and the shape of the audience changes without touching anything downstream.

Expressiveness that never breaks what you have

Adding boolean logic to segments raises an obvious worry: does making the language richer quietly change audiences that were fine before? Here it does not, and that is a guarantee rather than a hope.

The composition is pure and tested. It is built as a standalone function with no side effects, and property tests prove that a flat, AND-only definition compiles to exactly the same audience it always did. Expressiveness is added around your existing segments, never underneath them. Pure means the same inputs always yield the same audience, with nothing hidden in state, so the tests can pin the behavior down exactly.

How it fits the rest

Composition sits directly on top of model-driven segments. You still describe audiences in plain concepts, and the boolean layer simply lets those concepts combine with real logic. The result is one precise definition instead of a list you maintain by hand.

From there the audience flows on unchanged. A composed segment feeds a journey or a send like any other, so the precision you author once is the precision that actually ships.

Frequently asked questions

What is boolean segment composition?
It is building audiences with real logic instead of a single filter: ANY (OR) to widen, ALL (AND) to narrow, and NOT to exclude. It lets you say exactly who you mean, such as active power users who are not already in a journey.
What operators are supported?
Beyond equals, warehouse predicates support range operators: greater than, less than, and between. You can drop those into ANY, ALL, or NOT groups to express conditions like sessions greater than 10 or last active less than 7 days ago.
Will adding OR and NOT change my existing segments?
No. The composition is pure and property-tested, and those tests prove a flat AND-only definition compiles to exactly the same audience it always did. Expressiveness is added around existing segments, never underneath them.
How does this relate to model-driven segments?
Composition sits on top of model-driven segments. You still describe audiences in plain concepts, and the boolean layer lets those concepts combine with AND, OR, and NOT into one precise definition.
See the harness in action
Click through the real product, no signup, then request beta access.