# 3.4 Create a segment - UI

In this exercise, you'll create a segment by making use of Adobe Experience Platform's Segment Builder.

## Story

Go to [Adobe Experience Platform](https://experience.adobe.com/platform). After logging in, you'll land on the homepage of Adobe Experience Platform.

![Data Ingestion](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d3766e8abcdcae565589d172ff39148a026b3712%2Fhome.png?alt=media)

Before you continue, you need to select a **sandbox**. The sandbox to select is named `--aepSandboxId--`. You can do this by clicking the text **\[!UICONTROL Production Prod]** in the blue line on top of your screen. After selecting the appropriate \[!UICONTROL sandbox], you'll see the screen change and now you're in your dedicated \[!UICONTROL sandbox].

![Data Ingestion](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-f8fe0607dc3e272ebd2416a98220bb1d82c1a166%2Fsb1.png?alt=media)

In the menu on the left side, go to **Segments**. On this page, you can see an overview of all existing segments. Click on the **+ Create segment** button to start creating a new segment.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-75a06bee02c8562a5c026bfc0ec6ad6b2729f015%2Fmenuseg.png?alt=media)

Once you're in the new segment builder, you immediately notice the **Attributes** menu option and the **XDM Individual Profile** reference.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-ea8eb69ae1b1f49237ad53b4ef48afa1db73de92%2Fsegmentationui.png?alt=media)

Since XDM is the language that powers the experience business, XDM is also the foundation for the segment builder. All data that is ingested in Platform should be mapped against XDM, and as such, all data becomes part of the same data model regardless of where that data comes from. This gives you a big advantage when building segments, as from this one segment builder UI, you can combine data from any origin in the same workflow. Segments built within Segment Builder can be sent to solutions like Adobe Target, Adobe Campaign and Adobe Audience Manager for activation.

Let's build a segment which includes all **male** customers.

To get to the gender attribute, you need to understand and know XDM.

Gender is an attribute of Person, which can be found under Attributes. So to get there, you'll start by clicking on **XDM Individual Profile**. You'll then see this. From the **XDM Individual Profile** window, select **Person**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-2159c2180a696a1748911f7e06563d1aeb7c0cc0%2Fperson.png?alt=media)

You'll then see this. In **Person**, you can find the **Gender** attribute. Drag the Gender attribute onto the segment builder.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-7a20a1f4d57098e3f220e70e962b7f37dba7c5ea%2Fgender.png?alt=media)

Now you can choose the specific gender out of the pre-populated options. In this case, let's pick **Male**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-1e9d73985f8c01ffaa03431445595f3b1300c43a%2Fgenderselection.png?alt=media)

After selecting **Male**, you can get an estimation of the segment's population by pushing the **Refresh Estimate** button. This is very helpful for a business user, so that they can see the impact of certain attributes on the resulting segment size.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-0267a074d58edbd3f54ea20930a89023738d3090%2Fsegmentpreview.png?alt=media)

You'll then see an estimation such as the one below:

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-3ee79b1a26970a1d1838bc0a4e92c05b529f2db1%2Fsegmentpreviewest.png?alt=media)

Next, you should refine your segment a bit. You need to build out a segment of all male customers that have viewed the product **Proteus Fitness Jackshirt (Orange)**.

To build out this segment, you need to add an Experience Event. You can find all Experience Events by clicking on the **Events** icon in the **Fields** menu bar.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-17a881c7a46aea2b7c306c3cf8245125f3635fb5%2Ffindee.png?alt=media)

Next, you'll see the top-level, **XDM ExperienceEvents** node. Click on **XDM ExperienceEvent**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-4cad265b73f8cadbf50fa00d0306e51ef48e86ce%2Fsee.png?alt=media)

Go to **Product List Items**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-e3ef15da94ec8abdffaac9087f5953f80a0fb941%2Fplitems.png?alt=media)

Select **Name** and drag and drop the **Name** object from the left menu onto the segment builder canvas into the **Events** section.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-8ff26c53c5369c7bbf0beb1018182ed7ada779b8%2Feeweb.png?alt=media)

You'll then see this:

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-7d95a4821bac2dc8948450defd2db6fe9bf56a67%2Feewebpdtlname.png?alt=media)

The comparison parameter should be **equals** and in the input field, enter **MONTANA WIND JACKET**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-60f79c20cffbb7ea823b8d591599bf2ec64738ac%2Fpv.png?alt=media)

Every time you add an element to the segment builder, you can click the **Refresh Estimate** button to get a new estimate of the population in your segment.

So far, you've only used the UI to build your segment, but there's also a code-option to build a segment.

When building a segment, you're actually composing a Profile Query Language (PQL) query. To visualize the PQL code, you can click on the **Code View** switcher in the upper right corner of the segment builder.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d0579c6be846cb56517d8e9798521b2bf1e59493%2Fcodeview.png?alt=media)

Now you can see the full PQL statement:

```sql
person.gender in ["male"] and CHAIN(xEvent, timestamp, [C0: WHAT(productListItems.exists(name.equals("MONTANA WIND JACKET", false)))])
```

You can also preview a sample of the customer profiles that are part of this segment, by clicking on **View Profiles**.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d0b6889da60b22002fdd3f09d297cbda9cdf3852%2Fpreviewprofiles.png?alt=media)

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-3a4710e120daf77f3b7a98ee40f4d7da4953a325%2Fpreviewprofilesdtl.png?alt=media)

Finally, let's give your segment a name and save it.

As a naming convention, use:

* `--demoProfileLdap-- - Male customers with interest in Montana Wind Jacket`

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-66718b2016ef5c376204c29602984bf2818c5ff2%2Fsegmentname.png?alt=media)

Then, click the **Save and Close** button to save your segment, after which you'll be taken back to the Segment overview page.

![Segmentation](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b66be5a459cc7a807406b6edf4870ff907721640%2Fsavedsegment.png?alt=media)

You can now continue to the next exercise and build a segment through the API.

Next Step: [3.5 Create a segment - API](https://docs.adobesandbox.com/comprehensive-technical-tutorial-archive/module3/ex5)

[Go Back to Module 3](https://github.com/AdobePartnerTechnicalServices/aep-quickstart-guide/blob/main/module3/real-time-customer-profile.md)

[Go Back to All Modules](https://github.com/AdobePartnerTechnicalServices/aep-quickstart-guide/blob/main/overview.md)
