Intersects, union and except: understanding query operators

·

In this blog post we are going to dive in the variety of options that the Segment builder in Dynamics 365 Customer Insights – Journeys gives us. I am going to explain the following options:

  • Logic operators (AND/OR)
  • Intersect, union and except operators

Logic Operators (AND/OR)

First of all let’s dive in the logic operators. When creating a Segment you are presented with a blank ‘canvas’, in which you will be able to compose your desired Segment. Assuming you already know how to add fields to the Segment, let’s say that we have added two fields to Group 1. For example (I know this example is very random):

  • Address 1: City equals Veenendaal
  • Mobile Phone equals 0612345678

At the top of the group you will see an operator (and/or) when you select more than one field in the group. With this operator you can specify in more detail when a Contact (or Lead) should be in the Segment.

  • AND means that both fields need to be true before it returns the contact
  • OR means that at least one of the fields need to be true before it returns the contact

So if the AND operator has been selected, the contact has to meet both conditions regarding the City AND the Mobile Phone number.

If the OR operator has been selected, the contact can live in Veenendaal, but can either have another Mobile Phone number (or no number at all) and the contact will still be a Segment member.

Intersects, union and except operators

If you have multiple groups of fields, you can also specify operators. The operators are officially not labeled ‘Intersect’, ‘Union’ and ‘Except’ in the Segment editor, but are commonly used in database terminology.

The operators are:

TermLabel in Dynamics 365 Customer Insights – Journeys
IntersectAnd also
UnionOr
ExceptBut not

So how do these operators work? In this example I have created another group (behavioral) next to the group we created earlier. Between the groups we can see another operator appearing, which contains the options as mentioned in the table above.

Intersect (And also)

If you choose this option, it will only add a contact to the Segment when Address 1: City equals Veenendaal OR Mobile Phone equals 0612345678

When a contact meets one of these conditions, it will be ‘qualified’ for the first group.

In the second group, it will check if a Marketing event check-in has been created for the contact at least once in the past 28 days. If this is also true, it will be ‘qualified’ for the second group as well.

Both groups return ‘true’ as a statement for the contact, which means the contact will be added to the Segment. If only one group returns true as a result, then the contact will not be added to the Segment (or will be removed from it).

To illustrate this I have created a Venn diagram. You can see contacts who meet conditions per group, but there are also contacts who are in both groups (Contact 5 and 6). When you set this operator, your Segment will only contain Contact 5 and 6, because those contacts are the only ones who meet the criteria in both groups.

Union (Or)

If you choose this option, it will add a contact to the Segment when Address 1: City equals Veenendaal OR Mobile Phone equals 0612345678

When a contact meets one of these conditions, it will be ‘qualified’ for the first group.

In the second group, it will check if a Marketing event check-in has been created for the contact at least once in the past 28 days. If this is false for a specific contact, the contact will be added to the Segment.

In this case, only one of the groups returns ‘true’ as a statement for the contact. However, this is enough to meet the conditions of the operator (Union/Or), since at least one of the groups need to return ‘true’.

To illustrate I have created another Venn diagram. In this case, all contacts in the diagram will be added to the segment, since it combines the results of both groups (who meet the criteria) and adds those contacts to the Segment.

Except (But not)

If you choose this option, it will add a contact to the Segment when Address 1: City equals Veenendaal OR Mobile Phone equals 0612345678

When a contact meets one of these conditions, it will be ‘qualified’ for the first group.

In the second group, it will check if a Marketing event check-in has been created for the contact at least once in the past 28 days. If this is true for a specific contact, then the contact will not be added to the segment. The operator states that contacts will be added to a segment when they meet the criteria in Group 1, but not in Group 2. Which means that a contact who meets the criteria in both groups, or only the second group, will not be added to the Segment. Only contacts who meet the criteria in Group 1 will be added to the Segment.

To illustrate I have created another Venn diagram. In this case, only contacts in the first group will be added to the segment, since it excludes contacts who meet the criteria in the second group.

That’s it for now! I hope you will find this post useful and helps you create more challenging Segments. Please let me know if you have any feedback or if you found this post useful.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *