Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Segments - Is it possible to query an OR branch that includes an additional AND condition?

(0) ShareShare
ReportReport
Posted on by 110

I can't seem to figure out how to build an OR branch that also contains an additional AND clause...a "while also" if you will. 

For example, is it possible to query the following while building a segment?

Condition 1 = Value

AND ALSO

Condition A = Value

OR Condition A CONTAINS value AND Condition B does not contain data. (i.e. Condition A contains a value while also factoring in Condition B)

I ended up having to split this into two segments, as I couldn't figure out how to do an OR branch that also includes an AND as part of its condition. It'd be nice if I could have this as part of the same segment.

Thanks!

  • SEDE Profile Picture
    SEDE 110 on at
    RE: Segments - Is it possible to query an OR branch that includes an additional AND condition?

    Very easy to understand...thanks, Nya!

  • SEDE Profile Picture
    SEDE 110 on at
    RE: Segments - Is it possible to query an OR branch that includes an additional AND condition?

    Very easy to understand...thanks, Nya!

  • Verified answer
    Nya Profile Picture
    Nya 29,058 on at
    RE: Segments - Is it possible to query an OR branch that includes an additional AND condition?

    Hi, SEDE

    If my understanding is correct, the result you need is to always satisfy Condition 1 while satisfying Condition A equals to some value or satisfying (Condition A contains a value and Condition B does not contain a value).

     

    Here is an example of a Segment for Contacts to find out all contacts meet the following conditions:

    1. First Name = F6
    2. And Also Last Name = L6
    3. Or (Last Name contains value and Account does not contain value)

     

    Which you need to do is to split the Condition 1 into the other two conditions.

    1. First Name = F6 and Last Name = L6
    2. Or First Name = F6 and (Last Name contains value and Account does not contain value)

     pastedimage1615342281988v1.png

    So adding two query block in your segment and setting the Condition 1 you need into both of them can achieve your request.

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans