# 4.5 Query Service and Power BI

Open Microsoft Power BI Desktop.

![start-power-bi.png](/files/dSAQDPMkGIm21vgURRFt)

Click **Get Data**.

![power-bi-get-data.png](/files/t3D5zzTaEh2xeJlSV1fv)

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

![power-bi-connect-progress.png](/files/gYXtkXiVOSkZgwNcPczD)

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

![query-service-credentials.png](/files/oSayJFAVjn03UIfrYuVc)

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](/files/lAJQ6ie9fAK7Rc8QKDJY)

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](/files/oSayJFAVjn03UIfrYuVc)

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](/files/FY3UDAtc1bafKasN2452)

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

![power-bi-report-tab.png](/files/ve398YTKoMvCmrDGQPRh)

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

![power-bi-select-map.png](/files/03OdJY6L6pcwZq8Ze7ek)

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](/files/br5ujegXMgXnv5zHkqWW)

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](/files/p6EFJ41d2VBYyNC1JSot)

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](/files/8xQvpyyxJ4Dvniz3bRaq)

Select/unselect **callTopics** to investigate:

![power-bi-report-select-calltopic.png](/files/Csi9Boub7B320jz38gxZ)

You've now finished this exercise.


---

# 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.adobesandbox.com/comprehensive-technical-tutorial-archive/module4/ex5.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.
