---
title: "Calculate segment audience size in Sitecore CDP"
slug: "calculate-segment-audience-size-in-sitecore-cdp"
abstract: "How to calculate the audience size of a segment when you create it (Sitecore CDP)."
---
# Calculate segment audience size in Sitecore CDP

It is best practice to calculate the audience size of a segment when you create it or add a new rule in the segment builder. This is particularly useful when working with multiple rules, as it ensures you are using the intended comparators. Additionally, calculating the audience size allows you to view a sample `guest_ref` records included in the segment.

In [advanced mode](https://doc.sitecore.com/cdp/en/users/sitecore-cdp/introduction-to-batch-segmentation/using-advanced-mode-in-batch-segmentation-in-sitecore-cdp/write-an-sql-query-in-sitecore-cdp.html "Write an SQL query in Sitecore CDP"), you can also calculate the audience size within the SQL editor.

## Calculate the audience size in the segment builder

To calculate the audience size in the segment builder:

1. After you [create and add rules to a segment](https://doc.sitecore.com/cdp/en/users/sitecore-cdp/introduction-to-batch-segmentation/create-and-add-rules-to-a-segment-in-sitecore-cdp.html "Create and add rules to a segment in Sitecore CDP"), click **Validate** to make sure the segment query contains no errors.
2. After validation succeeds, click **Calculate Audience**. When finished calculating, the audience size displays as:
    - An integer under **Guests in segment**.
    - A percentage of the total guests under **Segment VS total guests**.

    ![Calculating the audience size of a segment in Sitecore CDP after validating it in the segment builder.](https://doc.sitecore.com/api/markdown-image/cdp/en/users/sitecore-cdp/images/Segment_builder_Validate.png)

3. Click **View sample**. The **View Execution Sample** dialog displays a maximum of 10 `guest_refs` that are included in the segment results.
4. Click ![cdp_seg_launch.png](https://doc.sitecore.com/api/markdown-image/cdp/en/users/sitecore-cdp/images/cdp_seg_launch.png) icon to open the guest profile in a separate browser window.

## Calculate the audience size in the SQL editor

To calculate the audience size in the SQL editor when in advanced mode:

1. After you [create a segment by writing an SQL query](https://doc.sitecore.com/cdp/en/users/sitecore-cdp/introduction-to-batch-segmentation/using-advanced-mode-in-batch-segmentation-in-sitecore-cdp/write-an-sql-query-in-sitecore-cdp.html "Write an SQL query in Sitecore CDP"), on the **Calculate audience** tab, click **Validate** to make sure the segment query contains no errors.
2. After validation succeeds, click **Calculate Audience**. When finished calculating, the audience size displays as an integer and a percentage of the total guests.

    ![Calculating the audience size of a segment in Sitecore CDP after validating it in the SQL editor.](https://doc.sitecore.com/api/markdown-image/cdp/en/users/sitecore-cdp/images/Segment_builder_Validate_advanced.png)

3. Click **View sample**. The **View Execution Sample** dialog displays a maximum of 10 `guest_refs` that are included in the segment results.
4. Click ![cdp_seg_launch.png](https://doc.sitecore.com/api/markdown-image/cdp/en/users/sitecore-cdp/images/cdp_seg_launch.png) icon to open the guest profile in a separate browser window.