Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Use SAQL in the CRM Analytics Dashboard
Use the CRM Analytics Studio user interface to modify existing SAQL queries or write
new ones. Writing SAQL queries in the user interface is the easiest way to get
started.
Every component in CRM Analytics uses SAQL behind the scenes. You can build a widget in
a dashboard, then switch to the SAQL view to see the SAQL query for the widget. Or, you can
create a lens while exploring a dataset, then switch to the SAQL view to see the SAQL query
for the lens.
Let’s look at the query generated by a widget in a dashboard.
- In your Salesforce org, open CRM Analytics Studio, then open a dashboard. For example, open Opportunity Details.
-
Click Edit.

-
Click a query to edit, for example Amount_1, then click Edit in the dropdown
list.

-
Click SAQL Mode to display the SAQL query.

-
View the SAQL query.
Here is the SAQL query for our example:
1q = load "DTC_Opportunity_SAMPLE"; 2q = filter q by 'Closed' == "false"; 3q = group q by all; 4q = foreach q generate sum('Amount') as 'sum_Amount'; 5q = limit q 2000; - Edit the query, then click Run Query to run the new query. For example, you could change the sum to average.