# Using SQL Editor

Follow these steps to create a dashboard using a SQL Editor:

1. Go to the **'SQL Editor'** tab.
2. Create a chart, write and run a SQL query to retrieve data. The query results will be displayed under the **'Data'** tab in the 'Visualize' section.
3. Click the **'Metrics'** tab to enter **Distributed metric mode** and drag dimensions and measures into the X-axis and Y-axis fields to create a chart. You can also select the chart type (Line, Area, Bar, Pie), and add a **chart name** and **description**.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FfSdzMXVTlj3uw4dAvb0U%2Fimage.png?alt=media&#x26;token=751649c3-a7b0-43cb-a4c6-81543d6bb822" alt=""><figcaption></figcaption></figure>

4. For Aggregated metrics, choose a metric from the dropdown, select a function (SUM, AVG, COUNT, MAX), and provide a chart name.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FdkPtpcJRn3OPzyYWd3ML%2Fimage.png?alt=media&#x26;token=524013cd-b377-4241-bdf2-536d97a978e4" alt=""><figcaption></figcaption></figure>

5. To publish the chart within a dashboard, click on the **'Publish Chart'** button. This will display a list of existing dashboards. If you want to create a new dashboard, click on the **'Add Dashboard'** button. A popup will prompt you to provide the **dashboard name and description**.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FsVKzzrDLGCYOdfKhSIoG%2Fimage.png?alt=media&#x26;token=005f10c2-ad54-47ac-b005-fc22b774e84a" alt=""><figcaption></figcaption></figure>

After entering these details, click **'Add'** to create the new dashboard. Then, select the newly created dashboard from the dropdown and click **'Publish'** to publish the chart within that dashboard.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FnPBuOVnAUFO849KxA7Gv%2Fimage.png?alt=media&#x26;token=331b3c89-aac1-4345-9781-242e5266c598" alt=""><figcaption></figcaption></figure>
