# How to create a report from multiple data sources?

This is your data table from the **SQL Workspace**:

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FhlwTcCWI12nNDfnAdWmF%2Fimage.png?alt=media&#x26;token=4cca540e-407c-45d2-84c4-5dc11fd36533" alt=""><figcaption></figcaption></figure>

This is your data table from **Google Sheets**:

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2Fmh2rYLaPfYf7Bl39pA9s%2Fimage.png?alt=media&#x26;token=6e51ab36-a6f9-4a92-9627-10e8564dbde0" alt=""><figcaption><p>Google Sheets</p></figcaption></figure>

Below is a **step-by-step guide** on how to create a **data flow that joins these sources** together.

## Step 1: Create data sources

To create a data source, please refer to[ this guide](https://docs.antsomi.com/cdp-365-user-guide-en/dataflows/data-source/create-a-data-source).

*Notes: Please proceed to create **two distinct data sources** - one for the SQL data table and another for the Google Sheets document.*

## Step 2: Create data destinations

To create a data destination, please refer to [this guide](https://docs.antsomi.com/cdp-365-user-guide-en/dataflows/data-destinations/create-a-data-destination).&#x20;

*Notes: To create a **data source for a report**, choose the corresponding option in the data flow settings, and **refrain from creating a data destination for it**.*

## Step 3: Create the data flow&#x20;

Hover your mouse over **Data**, choose **Batch stream.**&#x20;

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FDSQcYwl2dKA0QNCgBXmo%2Fimage.png?alt=media&#x26;token=c565269d-5b44-470e-baca-0bcd7671c119" alt=""><figcaption></figcaption></figure>

Click on the **+** button to initiate the creation of a new data flow.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FyocgKRDg5VjLCF2ixFrV%2Fimage.png?alt=media&#x26;token=ad5c62b0-d0b7-47f4-a626-892164a3dea6" alt=""><figcaption></figcaption></figure>

Choose 1 of the 2 data sources that you created.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2Fq7fHrRVU2ryYIoJa9TC0%2Fimage.png?alt=media&#x26;token=e456c731-e06e-48bb-bd17-6cb4bbb52eb5" alt=""><figcaption></figcaption></figure>

Choose the fields you need in the **first data source**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FjXS3DqI4ECwk1BoLNHfd%2Fimage.png?alt=media&#x26;token=4ae38d17-70cb-4c46-9c72-4682dae9d11e" alt=""><figcaption></figcaption></figure>

To incorporate **additional data sources** into your dataflow, choose the **Add Data** node. Then select the expected data sources.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FnIndbx9W4Pmvp5Nmipcw%2Fimage.png?alt=media&#x26;token=557d31f2-6841-4906-bdd5-4aef47737a07" alt=""><figcaption></figcaption></figure>

*Notes: Please refer to* [*this guide*](https://docs.antsomi.com/cdp-365-user-guide-en/dataflows/dataflows/creating-a-dataflows/action-node/add-data) *for working on the **data source** node.*

Also choose the fields you need in the **second data source**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2F6MP0ushlYG94gDRWTLlM%2Fimage.png?alt=media&#x26;token=19d5f32f-3b7f-4047-bd25-41fe5262d591" alt=""><figcaption></figcaption></figure>

Once you have set up the required data sources, utilize the **Join** action node to combine these sources based on specific conditions.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FExGqDtxIjp09i3i4v4X9%2Fimage.png?alt=media&#x26;token=0c948d25-8a73-4ac1-b401-25924a3067dc" alt=""><figcaption></figcaption></figure>

*Notes: Please refer to* [*this guide*](https://docs.antsomi.com/cdp-365-user-guide-en/dataflows/dataflows/creating-a-dataflows/action-node/join) *for working on the '**Join**' action node.*

Once you have joined the data sources, utilize the '**Branch**' function to divide the joined data into separate data destinations.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2F6Ob3ntGvcoaSpG9uav1T%2Fimage.png?alt=media&#x26;token=bc28b92f-0c3b-452a-b32f-ea6d3686eff4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FraVwYiK8ixFSi6k2yDns%2Fimage.png?alt=media&#x26;token=abe5f0cc-aa8f-4664-a237-b6d4c7332119" alt=""><figcaption><p>Add 'Branch' node to break the data destinations</p></figcaption></figure>

*Notes: Please refer to* [*this guide*](https://docs.antsomi.com/cdp-365-user-guide-en/dataflows/dataflows/creating-a-dataflows/action-node/branch) *for working on the '**Branch**' action node.*

To push the joined data for creating a **report**, utilize the (**1**) data destination. Alternatively, if you intend to push the joined data to a **Business Object**, use the (**2**) data destination.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2F1PgN4pgt5zUdQ2TmrJDD%2Fimage.png?alt=media&#x26;token=d00caea8-c93d-41f8-801e-1eb1974a5ac2" alt=""><figcaption></figcaption></figure>

To add a **Business Object** destination, click the **+** button at a branch, and choose the destination.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2F2euULxXYpbZ56uAW2awH%2Fimage.png?alt=media&#x26;token=7c4f9d8a-663b-462a-a7c1-d6659a869c12" alt=""><figcaption></figcaption></figure>

To **filter data** and direct it to the **appropriate data destination**, you can achieve this by writing queries using the **Filter** node.

Before proceeding to apply filters, it's essential to grasp the context. Your objective is to join data from multiple sources, where **unmatched data** will be imported to Business Object, and **matched data** will be used to create the report.

This matching result is achieved by applying an **All Row** condition, which matches data based on **email addresses**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FlwjxKFx2OjMglBuMNRpF%2Fimage.png?alt=media&#x26;token=ad95beae-602f-4660-a4f6-2b05640eeb2b" alt=""><figcaption></figcaption></figure>

To filter out **customers** who **do not exist** in the **SQL data table** but **exist** in **Google Sheets**, apply the filter condition **Email is null**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FKtzIW03CzfcB3YCAi1t3%2Fimage.png?alt=media&#x26;token=422db06a-6499-4d49-a82b-728747144a3f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FYDReKE2kJs9k2zvkDdjf%2Fimage.png?alt=media&#x26;token=02915700-d40a-4b7a-bde9-ac92a8dbf2de" alt=""><figcaption></figcaption></figure>

To filter out **customers who exist** in the **SQL data table** but **do not exist** in **Google Sheets**, apply the filter condition **Email address is null**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2F44N3V4JC3fyyiKABzXEW%2Fimage.png?alt=media&#x26;token=c1c127ae-2558-4efe-bf3c-a50820f31693" alt=""><figcaption></figcaption></figure>

*Notes: Exercise caution while applying filtering conditions using "**include**" and "**exclude**" to avoid unintended data omissions.*

## Result&#x20;

Navigate to the Data Sources of Insights, and find your **Save Data**.

<figure><img src="https://826840553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbtU4vFUxT5JkWYHePuoX%2Fuploads%2FwAOdMK7H10n4YVkXwna4%2Fimage.png?alt=media&#x26;token=d24ea888-34d9-4b0b-a7bf-fe0010ff88ab" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.antsomi.com/cdp-365-user-guide-en/use-cases/dataflows/how-to-create-a-report-from-multiple-data-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
