> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pba/9.3-analytics/pentaho-dashboard-designer-cp/create-a-chart/use-query-editor-pdd.md).

# 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](https://698418877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgb0b8jIz4HuPLxqQR6C4%2Fuploads%2Fgit-blob-5389f0829696335d2580eb85e437ef8b84c7889a%2FPUC_query_editor_insert_icon.png?alt=media)
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](https://698418877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgb0b8jIz4HuPLxqQR6C4%2Fuploads%2Fgit-blob-1ea438678bb7d2cf13978993c44128f574f82efc%2FPUC_chart_designer_insert_territory_category.png?alt=media)

   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](https://698418877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgb0b8jIz4HuPLxqQR6C4%2Fuploads%2Fgit-blob-88f904342509964922f299217e14394b7f7ae6dc%2FPUC_query_editor_preview.png?alt=media)

   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](https://docs.pentaho.com/pba/9.3-analytics/pentaho-dashboard-designer-cp/create-a-chart/use-chart-designer-pdd.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pentaho.com/pba/9.3-analytics/pentaho-dashboard-designer-cp/create-a-chart/use-query-editor-pdd.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
