Create custom groups based on user_id without adding new dimension

Let’s say I have a list of user_ids = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

group_a = [0, 2, 7, 8, 4]

group_b = [1, 3, 9, 5, 6]

Is it possible to compare these two groups for a certain measure, let’s say earnings, without creating a new dimension. I need to do this multiple times for different user_ids but I do not want to create a seperate dimension every time.

I have tried this as a custom filter:
matches_filter(${users.user_ids}, 0, 2, 7, 8, 4)
but then logically I can only see the results of group_a. Is there a way to see group_b as well, within the same graph?

0 1 646
1 REPLY 1

Hey Stephen!

Here’s a good duct tape method with Custom Measures:

  1. On the Explore you’ll be using, locate the Measure you want to create a filtered Measure from, and use the Gear to add a custom measure
    image
  2. In the “Filter Measure” prompt, use a matches_filter expression (be sure to use backticks around the filter definition) to choose specific entities to filter on

I mentioned this as the duct tape method; a more ‘persisted’ way of accomplishing this would be to have two measures (measure_cohort_a, and measure_cohort_b) that use templated filters so the cohorts can be dynamically modified as needed. The other bonus with this method is that you’d be able to pre-fabricate cohort variance analysis fields (in absolute or percentage-based terms). https://docs.looker.com/data-modeling/learning-lookml/templated-filters

Top Labels in this Space