---
schema_version: "1"
id: bc161a683e0a8591dc48cf985d9d64e3dd0c7dbdbf07b417d3caf61c93fbf63a
title: Create a Query with the Query Editor
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/bi_dashboard_step_saql_build.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_dashboard_step_saql_build.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d374c106db48e54860a5cff1d7d401cdecfedf245dd59ae46ad853646f65827b
description: Use the query editor to create or customize SAQL or SOQL queries. The query editor gives you additional flexibility over queries created by widget wizards or in the chart and table modes of the lens.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Create a Query with the Query Editor

Use the query editor to create or customize SAQL or SOQL queries. The query editor gives you additional flexibility over queries created by widget wizards or in the chart and table modes of the lens.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/images/icon_note.png)

Note If you modify a query using the query editor, you can no longer add dimensions, measures, and filters if you switch back to the table or chart view. However, you can still change the visualization parameters.

1. To open the queries panel, click an empty space in the dashboard canvas in the dashboard designer.
    
    ![The steps panel shows the steps defined in the dashboard.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_dashboards_steps_panel.png)
2. Click **Create Query**.
    
    ![The Select a Dataset screen shows a list of all fields in the dataset.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_dashboard_widget_select_a_dataset_includes_static_option.png)
3. Click **Dataset** for a CRM Analytics dataset or **Salesforce Direct** for a Salesforce object.
4. Select the dataset or Salesforce object that contains the data that you want to include in the query. Enter the name in the search box if your data source isn’t easy to find.
    
    The lens appears showing the default measure, Count of Rows.
    
    ![The explorer shows Count of Rows, by default, after you select a dataset.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_dashboards_explorer_default_bar_chart.png)
5. In the lens, click **Untitled Query** and enter the query label.
    
    CRM Analytics creates the query ID from the label. After you create the query, you can’t change the query ID. CRM Analytics refers to queries by their ID so dashboards don’t break if you change the labels.
6. To write a custom SAQL or SOQL query, click ![SAQL Mode button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_saql_mode_button.png).
    
    The query editor appears, showing the code for the current query.
    
    ![SAQL Editor](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_dashboards_saql_editor.png)
7. Edit the query as needed.
    
    For SAQL, the editor provides contextually smart, auto-completion suggestions. For more information about SAQL queries, see the [CRM Analytics SAQL Developer Guide](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-intro.html).
8. Click **Run Query** to validate the query.
    
    The **Done** button becomes active if the query is valid.
9. Click **Done**.
    
    CRM Analytics adds the query to the query panel, making it available for use by other widgets in the dashboard.
10. Save the dashboard.

- **[Tips for Working with SAQL Queries in the Query Editor](https://help.salesforce.com/s/articleView?id=analytics.bi_dashboard_step_saql_limitations.htm&release=264.0.0&type=5)**  
    Queries created or edited in the query editor have unique characteristics compared to other queries, like those queries created in the lens. Review the following tips for working with queries created in the query editor.
- **[Query Editor Considerations](https://help.salesforce.com/s/articleView?id=analytics.bi_dashboard_step_saql_considerations.htm&release=264.0.0&type=5)**  
    Keep these considerations in mind when switching to the Query Editor to update a query.

#### See Also

- [Query Properties for Analytics Dashboard](https://help.salesforce.com/s/articleView?id=analytics.bi_dashboard_step_properties_flex.htm&release=264.0.0&type=5 "Query properties define the query that returns results to display in the widget. These properties also specify how the widget behaves and interacts with other widgets in the CRM Analytics dashboard. The properties apply to dashboards created in the dashboard designer only.")