> ## Documentation Index
> Fetch the complete documentation index at: https://confidence-auth-testing.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter Assignments for Sample Size Calculations

> Learn how to filter past assignments on flags to improve sample size calculations.

**Filter Assignments for Sample Size Calculations**

Learn how to filter past assignments on flags to improve sample size calculations.

> [!NOTE]
>
> Assignment filtering applies to Warehouse Native only, because it requires editing the SQL query of an assignment table. On [Confidence Cloud](/docs/start/confidence-cloud.md), Confidence generates the assignment table for you.

When calculating [required sample size](/docs/capabilities/experiments/sample-size-calculator.md), you can filter past assignments on flags to include only users similar to those in your upcoming experiment.

## Why Filter Assignments

Users assigned by a flag that assigns all users behave differently from a flag that only assigns highly engaged users. This means the mean and variance of metrics differ for the two cohorts, and so do the required sample sizes. By filtering assignments in the exposure source on relevant flags, you ensure the exposure source is as similar as possible to your upcoming experiment.

## Enable Assignment Filtering

**1. Go to Admin > Data Tables > Assignment tables**

**2. Select Edit query**

**3. Adjust the SQL query to include a flag column**

Add a column called `flag` to your SQL query. The name can be in any case.

**4. Select Run query**

**5. Select the flag column**

In the **Configure table** section, select the column from the **Flag column** dropdown.

**6. Select Save**

## Filter Past Assignments on Flags

**1. Select your experiment**

Select the experiment you want to run the sample size calculation for.

**2. Open the sample size calculation widget**

Click the icon in the **Required sample size** section to open the sample size calculation widget.

**3. Edit the exposure source**

Click the edit icon in the Exposure source section to edit the exposure source.

**4. Select flags to filter on**

Select **Assignments** as the exposure source and add the flags you want to filter on.

## Related Resources

> **[Calculate Sample Size](/docs/capabilities/experiments/calculate-sample-size.md)**
>
> Run sample size calculations

> **[Sample Size Calculator Reference](/docs/capabilities/experiments/sample-size-calculator.md)**
>
> Deep dive into sample size calculations

> **[Assignment Tables](/docs/capabilities/metrics/assignment-tables.md)**
>
> Configure assignment data sources

> **[Power Analysis](/docs/capabilities/experiments/statistics/power.md)**
>
> Understand statistical power
