SAQL Queries
SAQL Queries
SAQL (Salesforce Analytics Query Language) powers every lens and dashboard. The UI writes it for you, but learning it unlocks advanced calculations.
The query pipeline
SAQL reads like a pipeline. Each line transforms a stream and assigns it back to q:
q = load "Opportunities";
q = filter q by 'StageName' == "Closed Won";
q = group q by 'Region';
q = foreach q generate 'Region' as 'Region', sum('Amount') as 'Revenue';
Grouping and aggregating
group defines the buckets and foreach ... generate produces the output columns. Common aggregations are sum(), avg(), count(), and unique().
Ordering and limiting
Use order q by 'Revenue' desc and limit q 10 to return a clean "top 10" result.
What's next
Next you'll turn these queries into interactive dashboards and predictions.
Data & Datasets
Learn how data flows into CRM Analytics through connections and recipes, and how datasets are structured and secured.
Dashboards & Einstein
Assemble queries into interactive dashboards, then add predictive intelligence with Einstein Discovery.