> For the complete documentation index, see [llms.txt](https://docs.lucernahealth.com/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lucernahealth.com/guide/insights-studio/population-builder/reference-guides/how-to-build-complex-populations.md).

# How to build complex populations

A complex population uses more than one group, which lets you build either/or logic rather than requiring every condition to be true at once.

#### Goal: Build a population for all diabetic members with an open care gap.

### Step 1. Break the question down

We want diabetic members who are overdue on their care, either an eye exam or a kidney evaluation.

Since we want members who are overdue on **either** one, each gap needs its own group.

Inside a group, all conditions must be true (AND). Between groups, only one needs to be true (OR). So a member with just an eye exam gap still qualifies, and so does one with just a kidney evaluation gap.

That breaks the request into three parts:

1. Members with an open eye exam gap
2. Members with an open kidney evaluation gap
3. Deceased members removed

### Step 2. Members with an open eye exam gap

Rather than build from scratch, check what already exists. Defining diabetic members takes several conditions, so it's more likely to be a population than a block.&#x20;

* Click Add Population to search.

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FKEvp1KZfBJlHsNOnF9Rr%2FfdsafScreenshot%202026-08-28%20at%201.44.10%E2%80%AFAM%201.png?alt=media&amp;token=d28b9e1f-7392-4ff8-a702-54e07025bbc4" alt=""><figcaption></figcaption></figure></div>

* Select Diabetic Eye Exam – Open. 'Open' is the one we want. Eligible gives us everyone who should get the exam, Completed gives us everyone who already has, and Open is the gap in between.

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FbHY16R8HskfIScpUoaSC%2FScreenshot%202026-08-28%20at%201.47.13%E2%80%AFAM%201.png?alt=media&amp;token=9f265ffe-d234-40c6-a68e-a7a98161c579" alt=""><figcaption></figcaption></figure></div>

### Step 3. The kidney evaluation gap

Now we add a second group, not another condition in this one. If we added the kidney evaluation below the eye exam, they'd be joined by AND, meaning a member would need both gaps to qualify. We want either one, so it goes in its own group.

* Click Add Group, then Add Population, and select Diabetic Kidney Evaluation – Open.

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FJ6ShyhFT5anCqf8SoZOA%2FScreenshot%202026-08-28%20at%201.48.28%E2%80%AFAM%201.png?alt=media&amp;token=7b196e70-eab1-4b94-886d-c88f65b00f07" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FOBF413FTOmjLXDDcbcAq%2FScreenshot%202026-08-28%20at%201.49.03%E2%80%AFAM%201.png?alt=media&amp;token=b29beaaa-edd9-493b-8222-f9265f2a470e" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FeRsep9wCZx3q1xpz0B28%2FScreenshot%202026-08-28%20at%201.49.45%E2%80%AFAM%201.png?alt=media&amp;token=32ddc83c-7116-4e12-9e0b-a27ec148db7e" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FcsBLVu1sLlxXle7KJ7ry%2FScreenshot%202026-08-28%20at%201.50.49%E2%80%AFAM%201.png?alt=media&amp;token=5210dcae-68c7-4b0a-ab51-c8003744f327" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FS8bIX8YpmqvLU7QlmldK%2FScreenshot%202026-08-28%20at%201.51.52%E2%80%AFAM%201.png?alt=media&amp;token=90da9541-1332-4f66-ad64-8d47ee1e6573" alt=""><figcaption></figcaption></figure></div>

* The count is lower than the two groups added together because members with both gaps are only counted once.

### Step 4. Exclude deceased members

With both groups added, we have our list. But we don't want deceased members in it, so we use Exclude.

* For removing deceased members, building from scratch is the best option. Click Exclude, then Add Field, and search for `deceased`.

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FNn34ML6ltskgQwapTjyN%2FScreenshot%202026-08-28%20at%201.53.01%E2%80%AFAM%201.png?alt=media&amp;token=5a51d3f1-a763-4aca-8e5d-762b6751a91c" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FJ62owsakjaTd7reYxhGV%2FScreenshot%202026-08-28%20at%201.53.47%E2%80%AFAM%201.png?alt=media&amp;token=17dece93-e6cb-44cb-84cb-27831ce1593c" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FoOx8sV24Bgb2QUqKEY3x%2FScreenshot%202026-08-28%20at%201.55.18%E2%80%AFAM%201.png?alt=media&amp;token=bf052510-612b-4f2c-b831-be1c9bb73149" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FQu7Ia9pUb6sct0OXEMzH%2FScreenshot%202026-08-28%20at%201.56.09%E2%80%AFAM%201.png?alt=media&amp;token=80340fb4-696b-485f-a6e7-32a6d29fa4cf" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2F2H2wG8FJtoN4joYHqWyN%2FScreenshot%202026-08-28%20at%201.57.17%E2%80%AFAM%201.png?alt=media&amp;token=46c2d77f-954e-4690-acd5-f98ca4db8dd9" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FHprxVMCrTddnYJYWrTWB%2FScreenshot%202026-08-28%20at%201.58.05%E2%80%AFAM%201.png?alt=media&amp;token=88a56e84-9679-49b0-a6ef-c6a8fedac738" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FINp7HLdLTsB8cc59r9nR%2FScreenshot%202026-08-28%20at%201.58.46%E2%80%AFAM%201.png?alt=media&amp;token=a9b20667-4857-488e-ae7a-8f0575388166" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2F0Yi33sI6FnjYHHqCovpe%2FScreenshot%202026-08-28%20at%201.59.45%E2%80%AFAM%201.png?alt=media&amp;token=b4568a83-d91b-4348-8c2d-303934b590b6" alt=""><figcaption></figcaption></figure></div>

* Select 'equals' as the operator and 'Yes' as the value.

### Step 5. Read the result

<div data-with-frame="true"><figure><img src="https://1578258752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXt8wjwK8SlPIzyfLwqU%2Fuploads%2FoivRRJDNCas9wyekeEKn%2FScreenshot%202026-08-28%20at%202.01.02%E2%80%AFAM%201.png?alt=media&amp;token=2db5292a-4e1d-4a56-b62c-bbcefa5583e0" alt=""><figcaption></figcaption></figure></div>

The funnel panel mirrors the query structure. Each group appears with its own count, the OR between groups is marked, and the Exclude section is shown separately with the number of members removed.

Group names auto-generate based on their contents, but you can rename one from the menu icon. Once renamed, auto-generation stops.

Drag rules to reorder them, or duplicate one with the copy icon. Can only duplicate, not blocks or populations.
