# 4.5 Query Service and Power BI

Open Microsoft Power BI Desktop.

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

Click **Get Data**.

![power-bi-get-data.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-897f1d5ccbd3426641b267261d4ec88ddb21abe8%2Fpower-bi-get-data.png?alt=media)

Search for **postgres** (1), select **Postgres** (2) from the list and **Connect** (3).

![power-bi-connect-progress.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-f377f89afd8e71fba40ac6e46504892a44baf233%2Fpower-bi-connect-progress.png?alt=media)

Go to Adobe Experience Platform, to **Queries** and to **Credentials**.

![query-service-credentials.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-6a829d00188ec2b2ed259ac126788a587db622fc%2Fquery-service-credentials.png?alt=media)

From the **Credentials** page in Adobe Experience Platform, copy the **Host** and paste it in the **Server** field, and copy the **Database** and paste it in the **Database** field in PowerBI, then click OK (2).

{% hint style="warning" %}
Make sure to include port **:80** at the end of the Server value because the Query Service does not currently use the default PostgreSQL port of 5432.
{% endhint %}

![power-bi-connect-server.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d59a48ed349c7b1c2a37ad314d57740091848d10%2Fpower-bi-connect-server.png?alt=media)

In the next dialog populate the User name and Password with your Username and Password found in the **Credentials** of Queries in Adobe Experience Platform.

![query-service-credentials.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-6a829d00188ec2b2ed259ac126788a587db622fc%2Fquery-service-credentials.png?alt=media)

In the Navigator dialog, put your **LDAP** in the search field (1) to locate your CTAS datasets and check the box next to each (2). Then click Load (3).

![power-bi-load-churn-data.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-0739d8aeeeaf578258407a6702cc967e8b6c8468%2Fpower-bi-load-churn-data.png?alt=media)

Make sure the **Report** tab (1) is selected.

![power-bi-report-tab.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-e442c20cbcaa0cecefcbfa525597fcafb3fae9c9%2Fpower-bi-report-tab.png?alt=media)

Select the map (1) and after it is added to the reporting canvas, enlarge the map (2).

![power-bi-select-map.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-21c2eedf9f7958b2c144d27f6320d8451b5572f4%2Fpower-bi-select-map.png?alt=media)

Next we need to define the measures and the dimensions, you do this by dragging fields from the **fields** section onto the corresponding placeholders (located under **visualizations**) as indicated below:

![power-bi-drag-lat-lon.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-34fda1daba95e1d66cdb00fc9de9418d134d1451%2Fpower-bi-drag-lat-lon.png?alt=media)

As measure we will use a count of **customerId**. Drag the **crmid** field from the **fields** section into the **Size** placeholder:

![power-bi-drag-crmid.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-2c9043b37a88a76a3dc5bc568474704c1f8bd601%2Fpower-bi-drag-crmid.png?alt=media)

Finally, to do some **callTopic** analysis, let's drag the **callTopic** field on to the **Page level filters** placeholder (you might have to scroll in the **visualizations** section);

![power-bi-drag-calltopic.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-5eef00bf2dc708bd513a8af0dd215f8b7b44b619%2Fpower-bi-drag-calltopic.png?alt=media)

Select/unselect **callTopics** to investigate:

![power-bi-report-select-calltopic.png](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-1de25d332e71fd0c284f70f70264435ca719ec43%2Fpower-bi-report-select-calltopic.png?alt=media)

You've now finished this exercise.
