Answers.Body: <p>Try passing your <code>relatedTo</code> parameters as an array:</p>
  
  <pre><code>{% set members = craft.users.group('members').relatedTo([ 'and', { targetElement: services }, { targetElement: locations } ]) %}
  </code></pre>
  
  <p>or a little easier to read:</p>
  
  <pre><code>{% set entries = craft.users({
      group: 'members',
      relatedTo: [
          'and',
          { targetElement: services },
          { targetElement: locations }
      ]
  }) %}
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>If you want to get only those users that are related to both services, add another relation to your parameter array:</p>
  
  <pre><code>{% set service1 = craft.categories.group('services').slug('service-1') %}
  {% set service2 = craft.categories.group('services').slug('service-2') %}
  {% set locations = craft.categories.group('locations').slug('location-1') %}
  
  {% set entries = craft.users({
      group: 'members',
      relatedTo: [
          'and',
          { targetElement: service1 },
          { targetElement: service2 },
          { targetElement: locations }
      ]
  }) %}
  </code></pre>
  
  <p><strong>Update:</strong><br>
  <em>(Copied the solution from Sean's <a href="https://craftcms.stackexchange.com/questions/5105/searching-members-fields">other question</a>, because it also fits here!)</em></p>
  
  <p>If you need to add those relations programatically, that's how I would do it:</p>
  
  <pre><code>{# Compose the relation param #}
  {% set relationParam = ['and'] %}
  
  {# Add to the relation param #}
  {% if condition1 %}
      {% set service1 = craft.categories.group('services').slug('service-1') %}
      {% set relationParam = relationParam|merge([{ targetElement: service1 }]) %}
  {% endif %}
  
  {% if condition2 %}
      {% set service2 = craft.categories.group('services').slug('service-2') %}
      {% set relationParam = relationParam|merge([{ targetElement: service2 }]) %}
  {% endif %}
  
  {# Get users of group "member" #}
  {% set users = craft.users.group('members') %}
  
  {# Further filter users - avoid passing an array with `['and']` only #}
  {% if relationParam|length &gt; 1 %}
      {% set users = users.relatedTo(relationParam) %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T11:44:49.293Z
Answers.Text: This returns all members with either categories. It is possible to do something like: {% set services = craft.categories.group('services').slug('service-1 AND service-2') %} ?
Answers.UserDisplayName: Sean Delaney
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T11:46:36.427Z
Answers.Text: Yes, will update my answer. Glad that passing the params as an array works!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T11:54:03.420Z
Answers.Text: Okay, I can see how this will work but there is an extra step I'll need help with...Another question...
Answers.UserDisplayName: Sean Delaney
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T11:54:41.247Z
Answers.Text: http://craftcms.stackexchange.com/questions/5105/searching-members-fields
Answers.UserDisplayName: Sean Delaney
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T12:00:59.253Z
Answers.Text: Are you able to help with the linked question also?
Answers.UserDisplayName: Sean Delaney
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-19T08:28:08.970Z
Answers.Text: @carlcs I think I may have spotted an error in that last block. I believe `relationParam|merge({ targetElement: service1 })` should be wrapped in brackets like so `relationParam|merge([{ targetElement: service1 }])`. I noticed it when adapting this for someone else's question.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-05T11:24:51.680Z
Answers.LastActivityDate: 2015-02-13T15:52:34.763Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: carlcs
Body: <p>Trying to get users in a members group related to multiple categories.</p>
  
  <pre><code>{% set services = craft.categories.group('services').slug('service-1, service-2') %}
  {% set locations = craft.categories.group('locations').slug('location-1') %}
  
  {% set members = craft.users.group("members").relatedTo("and", { targetElement: services }, { targetElement: locations } ) %}
  
  {{ members | length }}
  </code></pre>
  
  <p>Number of members returned is zero.</p>
  
  <p>Any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-05T11:33:49.183Z
Comments.Text: Hmm... this looks right to me, but you could try passing your `relatedTo` parameters as an array, Sean.
Comments.UserDisplayName: carlcs
Tags: <users><categories><relations>
Title: Users relatedTo multiple categories
ThreadText: # Users relatedTo multiple categories
  
  (Asked by: username_0 on 2014-12-05)
  
  Trying to get users in a members group related to multiple categories.
  
  ```
  {% set services = craft.categories.group('services').slug('service-1, service-2') %}
  {% set locations = craft.categories.group('locations').slug('location-1') %}
  
  {% set members = craft.users.group("members").relatedTo("and", { targetElement: services }, { targetElement: locations } ) %}
  
  {{ members | length }}
  
  ```
  
  Number of members returned is zero.
  
  Any ideas?
  
  **Tags:** users, categories, relations
  
  > **Comments:**
  > **username_1**: Hmm... this looks right to me, but you could try passing your `relatedTo` parameters as an array, username_0.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-12-05. Score: 23 | Accepted answer
  
  Try passing your `relatedTo` parameters as an array:
  
  ```
  {% set members = craft.users.group('members').relatedTo([ 'and', { targetElement: services }, { targetElement: locations } ]) %}
  
  ```
  
  or a little easier to read:
  
  ```
  {% set entries = craft.users({
      group: 'members',
      relatedTo: [
          'and',
          { targetElement: services },
          { targetElement: locations }
      ]
  }) %}
  
  ```
  
  **Edit:**
  
  If you want to get only those users that are related to both services, add another relation to your parameter array:
  
  ```
  {% set service1 = craft.categories.group('services').slug('service-1') %}
  {% set service2 = craft.categories.group('services').slug('service-2') %}
  {% set locations = craft.categories.group('locations').slug('location-1') %}
  
  {% set entries = craft.users({
      group: 'members',
      relatedTo: [
          'and',
          { targetElement: service1 },
          { targetElement: service2 },
          { targetElement: locations }
      ]
  }) %}
  
  ```
  
  **Update:**  
  *(Copied the solution from username_0's [other question](https://craftcms.stackexchange.com/questions/5105/searching-members-fields), because it also fits here!)*
  
  If you need to add those relations programatically, that's how I would do it:
  
  ```
  {# Compose the relation param #}
  {% set relationParam = ['and'] %}
  
  {# Add to the relation param #}
  {% if condition1 %}
      {% set service1 = craft.categories.group('services').slug('service-1') %}
      {% set relationParam = relationParam|merge([{ targetElement: service1 }]) %}
  {% endif %}
  
  {% if condition2 %}
      {% set service2 = craft.categories.group('services').slug('service-2') %}
      {% set relationParam = relationParam|merge([{ targetElement: service2 }]) %}
  {% endif %}
  
  {# Get users of group "member" #}
  {% set users = craft.users.group('members') %}
  
  {# Further filter users - avoid passing an array with `['and']` only #}
  {% if relationParam|length > 1 %}
      {% set users = users.relatedTo(relationParam) %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: This returns all members with either categories. It is possible to do something like: {% set services = craft.categories.group('services').slug('service-1 AND service-2') %} ?  
  > **username_1**: Yes, will update my answer. Glad that passing the params as an array works!  
  > **username_0**: Okay, I can see how this will work but there is an extra step I'll need help with...Another question...  
  > **username_0**: http://craftcms.stackexchange.com/questions/5105/searching-members-fields  
  > **username_0**: Are you able to help with the linked question also?  
  > **username_2**: @username_1 I think I may have spotted an error in that last block. I believe `relationParam|merge({ targetElement: service1 })` should be wrapped in brackets like so `relationParam|merge([{ targetElement: service1 }])`. I noticed it when adapting this for someone else's question.  
  
  ---
  
  