# Union

In this document, you’ll learn how to use the *Union* transformation in Astera Dataprep to combine datasets from different sources with an existing dataset in your Dataprep Recipe.

### Use Case

A company wants to combine its *North Sales* dataset with *South Sales* and *East Sales* datasets. These additional datasets may exist as files, shared project sources, or database tables. The objective is to consolidate them into a single unified dataset for analysis.

1. In the toolbar, click on *Union* and select the appropriate source type.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FkqxmUOeJvtVVSAycJMdr%2Fimage.png?alt=media&#x26;token=b353bc94-1905-49af-bb35-6730dcabc116" alt=""><figcaption></figcaption></figure>

2. This will open the *Recipe Configuration – Union* panel. In this panel you can configure the source-specific settings (see tabs below).

{% tabs %}
{% tab title="Dataset" %}

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FIeV5YDNxBxikMDow7lYX%2Fimage.png?alt=media&#x26;token=1ca025a8-7994-4195-a774-7513de7cf31b" alt="" width="372"><figcaption></figcaption></figure>

* **Dataset:** Select the dataset you want to union with from the drop-down.
  {% endtab %}

{% tab title="File " %}

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FQt3k18AJCLhdZDcwVAX8%2Fimage.png?alt=media&#x26;token=cb45600d-d8c8-41fd-81b1-271169e424f6" alt="" width="370"><figcaption></figcaption></figure>

* **Browse Path**: Use this to manually browse and select your source file.
* **Path from Variable**: Use this when your file path is dynamic and parameterized. To learn more about using variables click [here](https://documentation.astera.com/variables#using-variables-in-recipes).

For this use case, we’ll use the *Browse Path* option.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2Fs8bLgh1950vbtbTmXh2L%2Fimage.png?alt=media&#x26;token=d02f0801-4b7b-411d-9496-ec88b4567dcd" alt="" width="346"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Project Source" %}

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FP0Ja8TkM09k510XHMybx%2Fimage.png?alt=media&#x26;token=735c524d-2812-4025-b457-023eb5ea0bc0" alt="" width="369"><figcaption></figcaption></figure>

* **Filter Source:** Choose the type of source you want to use. You can filter by type or simply select *All*.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FTJfkkXs5GwbO0hdHLMNC%2Fimage.png?alt=media&#x26;token=703aa663-1b6b-48da-b512-bf27b0cdc6c8" alt="" width="417"><figcaption></figcaption></figure>

* **Shared Source:** From the drop-down, select the project source dataset you want to join.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2F9cet0RNturV3pvVXaIPv%2Fimage.png?alt=media&#x26;token=4901e83b-2762-4e4c-8419-50e5c07e4ffa" alt="" width="347"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Database Table" %}

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FfgdLHDAEtfRvtimVgVdz%2Fimage.png?alt=media&#x26;token=5d0297a0-7773-43e6-ac6d-353a1edeb332" alt="" width="370"><figcaption></figcaption></figure>

* **Connection Name:** Select the shared connection you want to use. The drop-down lists all shared connections available in the project.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FTZN4Xno1KokCeUIb7X2Q%2Fimage.png?alt=media&#x26;token=41a99b64-fc66-45cd-890f-56ab6da7ba10" alt="" width="347"><figcaption></figcaption></figure>

* **Table:** From the drop-down, choose the database table you want to union with. In this example, we’ll select the *southsales* table.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2F7Fw1ZVIUUkUYNQZG7Gcf%2Fimage.png?alt=media&#x26;token=08776145-0a9f-4bd2-86ee-da99cd672520" alt="" width="347"><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

3. Provide a name for the union dataset (or keep the default name).

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FGXXjDnRmETBgs5eOB4wE%2Fimage.png?alt=media&#x26;token=58499b32-2fa6-4ee7-85d6-8063fff2b636" alt="" width="335"><figcaption></figcaption></figure>

4. Choose a *Union Type*:

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FjrrwozTEvhhzmUPuTlsy%2Fimage.png?alt=media&#x26;token=7f4f043d-52c7-48cd-a6a0-11d080a312e3" alt="" width="347"><figcaption></figcaption></figure>

* **Matching:** Returns only the fields that are present in both datasets.
* **All:** Returns all fields from both datasets.
* **Remaining:** Returns fields present in the current dataset along with the fields present in both datasets.

5. Once you’re done, click <img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FifRsY7qKnkoiKAz3ijZ3%2F7.png?alt=media" alt="" data-size="line"> *Apply.*  The result will appear in the grid.

<figure><img src="https://3181888596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzEifS4h8yurLAAwiGNX2%2Fuploads%2FmRKXCyb1EOavIk7D1ieg%2Fimage.png?alt=media&#x26;token=6d8207fa-9faf-40cb-9067-0b2948570f02" alt=""><figcaption></figcaption></figure>
