AND Operator in Filters

  • 14 August 2019
  • 2 replies

Hey Looker Community -

I’ve been trying to use an AND operator when applying a filter in a simple Dashboard Tile, and I haven’t been able to. When I Merge Results, I can’t get the visualization I’m looking for. If this was straight SQl, I’d create a View and then query the view to get the result I want, but that doesn’t work in dashboard tiles.

Essentially, I have a set of Users, and they can be in several Groups. A simple query will just show the user, a group they are part of, and then repeat the same user and a different group on a new line.

I’m trying to find a set of users that are in two specific Groups. So sorry if my question isn’t clear, I’d really appreciate the help!

2 replies

Hi Elizabeth,

I haven’t had much chance to think about this although one hacky way to do it (I’m sure other people might suggest more efficient ways!) would be to set up a measure to count groups, then set up a look with two columns: user, and group count. This should then give you the number of groups a user belongs to. Filtering the group dimension to the groups you want a list of users for (e.g. Group 1 and Group 2), you know that any users with a group count of 2 belong to both groups.

As I say a bit hacky but it’s a way to do this without using SQL specifically - hope that makes sense, happy to provide more clarity if needed!

Hi Adam -

Thanks so much! I really appreciate your help. Then I’ll do a calculated field that says if Group Count = 2, then Yes, otherwise No, and count how many yes’s there are. Thanks!