Loading
CRM Analytics
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create a Query with a Lens

          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.

          For information about clipping a lens to create a query, see Clip a Lens to a Dashboard.

          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.
          2. If the queries panel has existing queries organized in sections, click Add Step button next to the a section to create a query of that type.
            For example, click Add Step button next to the Static section to create a custom query. This feature is available for all section types, except Apex, Soql, and multiple-dataset queries.
          3. Click Create Query.
            The Select a Dataset screen shows a list of all fields in the dataset.
          4. Click Dataset for a CRM Analytics dataset or Salesforce Direct for a Salesforce object.
          5. 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.
          6. 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.
          7. To add a measure, click + under the Bar Length field.
            The Count of Rows measure shows, by default. To change a measure, click the measure and then choose a new one.
            You can add as many measures as needed.
          8. To group the measures by a date or dimension, click + under Bars, and then select the field.
            You can add multiple groupings. To change a grouping, click the grouping and select a new field. To reorder or delete a grouping, click the down arrow to the right of the grouping and then select the option.
          9. To add a filter, select Filters, click + under Filters, and then select the field to filter by.
            You can add multiple filters.
          10. To change the chart or table type for the query, click Chart Mode button or Table Mode button, respectively.
          11. To set the widget properties at the query-level, click Properties button.
            The chart properties appear in the right pane.
          12. To write a custom SAQL or SOQL query, click SAQL Mode button.
            For more information, see Create a Query with the Query Editor.
          13. Click Done.
            CRM Analytics adds the query to the query panel, making it available for use by other widgets in the dashboard.
            Tip
            Tip If you drag the query to the dashboard designer canvas, CRM Analytics displays the query results as the chart specified while creating the query. To display the widget differently in the dashboard than what was specified at the query level, select the widget in the dashboard and then set the widget properties. The widget properties override the query settings.
          14. Save the dashboard.
          • Tips for Salesforce Direct Data Queries
            Direct Data is an option for querying live Salesforce data without having to set up replication or create datasets. With Direct Data, you can query Salesforce objects in the dashboard designer’s explorer and edit Salesforce Object Query Language (SOQL) queries in the query editor.
           
          Loading
          Salesforce Help | Article