Segments in Customer Insights - Journeys: Nested Conditions

Another episode of real-time segment building in Dynamics 365 Marketing (Customer Insights - Journeys). This post will show you how to build segments with nested conditions which use a combination or AND and OR. Thankyou Harley for the question!

For my other real-time segment builder posts take a look here.

Groups and Subgroups, Sub-Subgroups & Sub-Sub-Subgroups

The grouping can be very powerful but also very overwhelming, especially when they have such non descript number based naming. It also means there are many ways to achieve the same outcome, I like to try and combine conditions which share the same pathway to make it a little easier to read but I also tend to avoid going any deeper than subgroup because it makes my brain explode.

Beware there is a limit to how many groups you can have in a single segment which may force you to go deeper than sub-group.

Grouping can be up to 4 layers deep

Creating groups

I find it much easier to first, create the groups and sub groups, then start adding attributes using the numbers as reference marks on where I want the attribute to land.

The first layer of subgroup can be added using the ‘+ Add a subgroup’

Example: Contacts, with multiple leads, where they may meet criteria X (a combination of Y +Z) on any lead

Contact is A + B AND a related Lead is Y1+Z1 OR Y2+Z2 OR Y3+Z3

Note: I use Lead as an example here (via Parent Contact) but this could be any table out of the box or custom that has a one to many relationship.

Lets start at the end - this is the structure and query we need to build.

Laying out the structure first, and then filling in the blanks with attributes helps to stop getting lost in the weeds

Nested conditions for a Contact one to many relationship

Step by step

Create a ‘Contact’ based segment

Add an attribute group for Contact filters

This group will be used for any contact specific filters that you need such as ‘Email address not blank’ or ‘Status is Active’

Add another group for the related table filters

In this case we filter on the Leads via Parent Contact, butt his could be any one to many relationship

Add subgroups and change condition to OR

Within Group 2 - select ‘+ Add a subgroup’ three times. Change the condition next to ‘Group 2 uses’ to OR

Three subgroups using an overarching OR

Add a condition to Group 2.1

Our condition is going to be based on Lead Industry and Annual Revenue for the example but you can use anything you need here. Select ‘Annual Revenue’ from the ‘Related table’ Lead into Existing Group -> Group 2.1

Define the Contact to related table pathway

In this case we are doing going Contact to Lead via Parent Contact but this will depend on the table/relationship you are using.

You may have to map this pathway multiple times throughout the segment building, just make sure you are consistent in the pathway you use!

Add another condition to Group 2.1

Select ‘Industry’ from the ‘Related table’ Lead into Existing Group -> Group 2.1

Checkpoint for Group 2.1

You might need to define the pathway from Contact -> Related table again as seen above. Your segment should now look like below.

Add conditions to Group 2.2 and Group 2.3

Repeat adding ‘Annual Revenue’ and ‘Industry’ into Group 2.2 and Group 2.3. Define the pathway the same as above as/when needed. You can see that each combination of ‘Annual Revenue’ and ‘Industry’ uses an AND but only one of the combinations needs to match because Group 2 uses OR as an overall evaluator.

Define the conditions for each subgroup

I will leave this up to you but for the example I’m using ‘Annual Revenue’ is more than $x and ‘Industry’ is a specific value.

Add Contact specific conditions to Group 1

Any Contact specific conditions should be added via Existing Group -> Group 1

Define the conditions for the Contact

This can be as extravagant or minimal as you wish. If I’m creating a segment for emails I will always ensure to only include contacts with emails to ensure my segment represent the true potential reach.

Aaaaaand, done!

Set the segment as ‘Ready to use’, verify the list members and you are ready to fly!

Creating the group layout then filling in the attribute/conditions has been most helpful for me in structuring queries in the new builder - I hope it helps you too!

That’s all

Questions, suggestions and helpful additions welcome. Share your segment struggles below, I’m remain than happy to help (and use your issues as blog post inspiration) for now, until my brain explodes in subgroups!

More real-time segments struggles available here.

Previous
Previous

List Segment Members from Customer Insights - Journeys in Power Automate

Next
Next

Segments in Customer Insights - Journeys: Activities (Email, Appointment, Phone Call etc.)