SAQL Basics
SAQL Basics
SAQL (Salesforce Analytics Query Language) is the language every dashboard chart compiles down to. You rarely write it for simple charts, but understanding it unlocks debugging and custom widgets.
Anatomy of a query
A SAQL query is a pipeline of statements, each transforming the result of the one before it:
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 'TotalRevenue';
- load — start from a dataset.
- filter — keep only matching rows.
- group — bucket rows before aggregating.
- foreach ... generate — project the fields and aggregates you want out.
Where you'll see it
Every widget on a dashboard has an underlying Edit query option in the Explorer/Dashboard Editor that reveals the exact SAQL running behind it — the fastest way to learn by example.
What you'll learn next
Next: filtering and grouping in more depth, with real operators and functions.
Saved Views & Sharing
Save your own filtered view of a dashboard and share dashboards, snapshots, or exports with teammates.
Filtering & Grouping
Write SAQL filter conditions and group-by clauses, including multi-level grouping for drill-down charts.