---
title: Use Multiple Fields as the Unique Field in Deduplication
slug: segment/use-multiple-fields-as-the-unique-field-in-deduplication
createdAt: 2026-01-15T20:25:01.138Z
---

This page explains how to deduplicate the records of a Data Extension including multiple fields as the unique field.

:::hint{type="info"}
This scenario uses the feature [Apply any function (SQL) Custom Value](docId\:RJbXaWTt2peObUSkbgzDM), which is only available o&#x6E;**&#x20;Unaric Segment Advanced***.*
:::

## Overview

Assume you have a Data Extension called *Orders*, with the following records:

| **Person** | **Product** | **Quote** | **Version** | **Date** |
| ---------- | ----------- | --------- | ----------- | -------- |
| A          | Car         | 1         | 1           | 5/1/2021 |
| A          | Car         | 1         | 2           | 5/2/2021 |
| A          | Car         | 2         | 1           | 5/3/2021 |
| A          | Car         | 2         | 2           | 5/4/2021 |
| A          | Fire        | 1         | 1           | 5/5/2021 |

You would like to keep only unique combinations of person-product pairs. Ideally, the one with the highest quote, the newest version, and the latest Date. In this case, you would like to keep the last two rows.

## Setup

:::::WorkflowBlock
:::WorkflowBlockItem
### Input

Drag and drop your *Orders&#x20;*&#x44;ata Extension to your **Selected Data Extensions**.
:::

:::WorkflowBlockItem
### Create your Target Data Extension

You need to create a field to use in deduplication. Since you need unique combinations of *Person&#x20;*&#x61;nd *Product* you will create a custom value that combines these two fields.

1. In the **Output** step, click the **Create Data Extension&#x20;**&#x62;utton.
2. Provide the name *Deduplicated DE on multiple fields&#x20;*&#x61;nd click **Save**.
3. Click **Add new value&#x20;**&#x69;nside the **Custom Values** area.
4. Set the name to *Id*.
5. Select **Apply formula to a field**.
6. Select **Apply any function**.
7. Under the *Insert field&#x20;*&#x73;ection, select *Orders* Data Extension and *Person* field.
8. Click the **Insert field&#x20;**&#x62;utton.
9. In the formula section, add a white space, a plus icon (+), and one more white space.
10. Under the *Insert field&#x20;*&#x73;ection, select *Orders* Data Extension and *Product* field.
11. Click on the **Insert field&#x20;**&#x62;utton. Your formula should now look as follows:

::Image[]{src="https://support.deselect.com/hc/article_attachments/360020168037" size="60" width="628" height="512" isUploading="false" darkWidth="628" darkHeight="512" showCaption="false"}

12. Click the **Save&#x20;**&#x62;utton.
13. Add the *Id&#x20;*&#x63;ustom value to your Target Data Extension's fields.
14. Click the **Add All Fields&#x20;**&#x62;utton of your *Orders&#x20;*&#x44;ata Extension, under the **Available Fields** section.
:::

:::WorkflowBlockItem
### Set deduplication rules

After creating your Target Data Extension, you can set the deduplication rules, and deduplicate using the custom value you created as the unique field. Then, you can proceed with defining the priority criteria, as you would normally do.

1. Click **Save Data Extension** and click the **Create** button on the pop-up.
2. Click the gear icon on the right and select **Prio Deduplication**.
3. Select *Id* as the unique field and click **Next**.
4. Select *Quote* from the dropdown and sort all values from highest to lowest.
5. Click **Add Sorting Option**. Select *Version* from the dropdown and sort all values from highest to lowest.
6. Click **Add Sorting Option**.
7. Select *Date* from the dropdown and sort all values from highest to lowest. Your deduplication logic should look similar to the image below:

::Image[]{src="https://support.deselect.com/hc/article_attachments/360020302638" size="50" width="709" height="858" isUploading="false" darkWidth="709" darkHeight="858" showCaption="false"}

8. Click **Confirm**.
:::

::::WorkflowBlockItem
### Preview

Click the **Run Preview&#x20;**&#x62;utton. You should see the following results:

::Image[]{src="https://support.deselect.com/hc/article_attachments/360020275298" size="90" width="1833" height="327" isUploading="false" darkWidth="1833" darkHeight="327" showCaption="false"}

:::hint{type="success"}
When you want to remove duplicates using a combination of fields, you can use the *Custom Values* feature. With *Custom Values*, you can combine the fields into a single value, to use later on in *Prio Deduplication.*
:::
::::
:::::

