You are here:
Manage Queries for Widgets
Queries return results that are displayed in widgets. For example, a number widget displays the result of a calculation that is defined in a query. Queries can be built on a data source, like a dataset or a Salesforce object. They can also be “custom queries” created with user-defined values.
Watch a Demo:
Use Steps to Build Wave Dashboard Widgets (English
Only)
To create a query, you can clip a lens from an exploration, use the widget wizard, or create a query manually in dashboard designer. The widget wizard creates a basic query that meets the minimum requirements for the widget. If you need a more robust query, like one that has customized SAQL, manually create your own. The method you choose depends on how much flexibility you need.
Behind the scenes, CRM Analytics assigns a unique ID to each query in the dashboard. Because query IDs, like “Amount_1,” are not always descriptive, add a query label when you create the query. For example, to clarify the “Amount_1” query, you can add the label “Won Opportunity Amount.” CRM Analytics generates the query ID based on the label. After creating the query, you can’t change the ID, unless you edit the JSON.
To improve dashboard performance, minimize the number of queries in a dashboard. When possible, reuse a query for multiple widgets. You can reuse any query, except a range or date widget’s query.
- Queries and Custom Queries
Widgets that display data require queries. A widget displays the results returned by a query. For example, a query calculates the average opportunity amount, grouped by region. The widget displays the results in a bar chart format with each bar showing the average amount for a region. - Create a Query with a Lens
Manually create a query from the dashboard designer when you’re concerned about the results it returns and not the widget that displays those results. For example, you might build a query that calculates three measures. You can display all measures in a combo chart and display each measure in a separate number widget as well. You can reuse queries in multiple widgets. - 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. - Create a Custom Query with User-Defined Values
Use custom queries to apply user-defined values to dimensions, measures, and limits of other queries. For example, you can create a toggle widget that filters case records based on the following user-defined values: High Priority Cases, Medium Priority Cases, and Low Priority Cases. To enable these custom values to filter your data, you map them to your data using a binding. - Find a Query
You can find all queries defined in the dashboard in the query panel. The panel organizes queries into categories and provides a search bar to help you locate your queries faster. - Edit a Query
When you edit a query, you can change the details, like the query label. These changes affect all widgets that use the query. You can also change the visualization properties, like chart type. Depending on the method that you use to edit the query, CRM Analytics handles visualization changes differently. - Clone a Query
Clone a query to quickly create a query based on an existing one. Cloning is useful when you can reuse an existing query with just a few tweaks. - Modify the Query Results Based on the Dashboard Viewer
You can modify a query based on the user viewing the dashboard. For example, you can filter opportunity records to show only those opportunities owned by this user. - Manage Filters from Linked or Embedded Dashboard with External Filters
External filters enable you to determine whether dashboard queries can be influenced by filters from linked or embedded dashboards. This means you can selectively apply external filters to specific queries while keeping others isolated. - Migrate CRM Analytics Queries to Data 360 SQL (Beta)
Data 360 SQL provides improved data handling, larger result sizes, and better scalability. New compact form queries and custom SQL queries now run on Data 360 SQL by default. Existing custom SQL queries continue to use legacy SQL, and can be switched manually to Data 360 SQL for improved performance. - Reuse Results for Data 360 Live Queries
Balance dashboard performance and data freshness by configuring how long to reuse query results. CRM Analytics reuses results when you run the same query with the same data access. This reuse improves dashboard responsiveness and reduces repeated queries. Set how long results remain valid before retrieving fresh data. - Dashboard Compatibility Considerations for External Filters
Dashboards created in Summer '25 or later with external filters and targeted faceting can experience errors. These issues commonly occur from inconsistencies during sandbox-to-production org migrations or discrepancies in API versions during deployment. - Optimize a Query
Queries can slow down your dashboard. Run a performance check on the queries to ensure that they’re running optimally. CRM Analytics identifies query bottlenecks and provides recommendations to improve query performance. - Considerations for Queries with Multiple Datasets
When a query has multiple datasets, the query results are formatted using the XMD of the first loaded dataset. If the query is faceted, it receives filters for all of its datasets, but broadcasts selections only from its first loaded dataset. - CRM Analytics Quick Sort: Limitations and Guidance
CRM Analytics offers a powerful quick sort feature, enabling users to sort data directly within table and chart widgets by clicking column headers. However, some query configurations can interfere with this functionality. This document outlines known limitations and provides best practices for effective use of the quick sort feature. - Troubleshoot Unexpected Query Results
If you have questions about a query’s results, review the query details to learn how CRM Analytics determines the results. Compare the original query to the final query executed by CRM Analytics. If the query is faceted or the dashboard contains global filters, CRM Analytics applies extra filters to query. If the query contains a binding, use the bindings tracer to verify the binding results. - Query Properties for Analytics Dashboard
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.
See Also
- Add Chart Widgets to Visualize Data
- Add a Date Widget to Filter Dashboard Results Based on a Date
- Add a List Widget to Filter Dashboard Results Based on a Dimension
- Add a Range Widget to Filter Dashboard Results Based on a Measure
- Add a Toggle Widget to Filter Dashboard Results Based on a Dimension
- Add Number Widgets to Include Key Metrics
- Add a Global Filter Panel Widget to Filter Data from the Dashboard
- Add a Table Widget to Show Record Details and Create Calculated Columns
- Make the Dashboard Widgets Interactive

