Create and query a Calculated Insight in Salesforce Data Cloud to surface pre-aggregated metrics and dimensions

domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.

Steps

  1. In Data Cloud Setup, navigate to Calculated Insights and click New; write an ANSI SQL SELECT statement that uses aggregate functions (SUM, AVG, COUNT) for measures and non-aggregated columns for dimensions, then save and activate the insight.
  2. Retrieve metadata about available calculated insights via GET https://<tenant-url>/api/v1/insight/metadata/ — the response lists each insight's name, measures, dimensions, and related DMOs.
  3. Query insight data via POST https://<tenant-url>/api/v1/insights/<calculatedInsightApiName> with a JSON body specifying sql (optional filter), limit, offset, and timePeriod granularity (HOUR, DAY, MONTH, QUARTER, YEAR).
  4. Paginate through the response using the limit and offset parameters; each response includes the data rows and a count of total matching records.
  5. Reference the insight from the Data Cloud Query API with standard SQL: SELECT <measureName>, <dimensionName> FROM <InsightApiName>__dlm.
  6. Monitor calculated insight run history in Data Cloud Setup to verify that scheduled refreshes are completing without errors before relying on query results.

Known gotchas

Related routes

Build a Calculated Insight in Salesforce Data Cloud using the ANSI SQL editor to compute segment-level metrics
developer.salesforce.com · 6 steps · unrated
Query the dbt Cloud Semantic Layer GraphQL API to retrieve metric values with dimension breakdowns
docs.getdbt.com · 5 steps · unrated
Model a Cube cube schema with measures, dimensions, and a rollup pre-aggregation to accelerate dashboard queries
cube.dev · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans