# Use Query Editor

To create a chart, you must first choose a data source, which contains the data you want displayed in your chart.

Follow these basic steps to define data with the Query Editor using a sample dashboard provided with the Pentaho User Console (PUC).

1. In PUC, click **Browse Files** and navigate to **Public** > **Steel Wheels**. Locate the `Sales Performance (dashboard)` and double-click to open it.
2. Click the **Edit Content** icon to edit the dashboard.
3. In the dashboard, find the Orders by Country panel and click the **Insert Content** icon. In the drop-down menu that displays, select **Chart**.

   ![locations of dashboard and Query Editor icons](/files/irKEPcOmTKZn30LPCQxt)
4. Click **OK** to discard the current content.

   The Select a Data Source dialog box appears.
5. Select the data source **Orders** from the list of available choices and click **OK**.

   The data source contains the content you want to display in your chart.

   The Query Editor appears. You can use the Query Editor to retrieve dynamic data from a database for display in a chart. Defining your query is the first step in ensuring that the correct data is selected.
6. In the Query Editor, click the **Plus Sign** next to a category name to expand its associated table columns.
7. Click the small **right arrow** beside **Selected Columns** to place **Territory** under **Selected Columns**.

   In the example below, the **Territory** column has been selected (shaded in red) and added to **Selected Columns**.

   ![Select columns in Query Editor](/files/Q52AGbfzJtcrfL4b2ZfC)

   Notice that the Column names appear under **Selected Columns**.
8. Continue by adding **Total** in the **Orders** category to the**Selected Columns**.
9. Click **Preview** to see an example table of the data.

   ![Query Editor preview](/files/688dJNDuUTwQkQ09N2di)

   When finished, click **Close** to exit the preview.
10. Click **OK** when you have finished defining the data.

    The Chart Designer appears.

You are now ready to proceed with the tutorial steps in [Use Chart Designer](/pba/9.3-analytics/pentaho-dashboard-designer-cp/create-a-chart/use-chart-designer-pdd.md)


---

# 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.pentaho.com/pba/9.3-analytics/pentaho-dashboard-designer-cp/create-a-chart/use-query-editor-pdd.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.
