Tableau CRM SAQL Developer Guide

Analytics SAQL Developer Guide

Salesforce, Spring '24

@salesforcedocs

Last updated: January 12, 2024

? Copyright 2000?2024 Salesforce, Inc. All rights reserved. Salesforce is a registered trademark of Salesforce, Inc., as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.

CONTENTS

OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Use SAQL in the CRM Analytics Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 SAQL Null Measures and Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

QUICK START . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Write Your First Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Create a Derived Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Create a Derived Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Analyze Your Data Over Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Calculate How Long Activities Take . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Display the Opportunities Closed This Month . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Forecast Future Data Points with timeseries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Combine Data from Multiple Data Streams with cogroup . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Replace Null Values with coalesce() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Dynamically Display Your Top Five Reps with Windowing . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Append Datasets using union . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Calculate the Slope of the Regression Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Show the Top and Bottom Quartile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Calculate Grand Totals and Subtotals with the rollup Modifier and grouping() Function . . . . . . 19

SAQL REFERENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

SAQL Basic Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 SAQL Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 SAQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 SAQL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

QUERY PERFORMANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Speed Up Queries with Dataflow Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Limit Multivalue Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Use Group and Filter Pre-projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Remove Redundant Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Check for Redundant Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Limit the Use of unique() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 arimax Show Parameters Query Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

OVERVIEW

Use SAQL (Salesforce Analytics Query Language) to access data in CRM Analytics dataset. CRM Analytics uses SAQL behind the scenes in lenses, dashboards, and explorer to gather data for visualizations. Developers can write SAQL to directly access CRM Analytics data via: ? CRM Analytics REST API

Build your own app to access and analyze CRM Analytics data or integrate data with existing apps. ? Dashboard JSON

Create advanced dashboards. A dashboard is a curated set of charts, metrics, and tables. ? Compare Table

Use SAQL to perform calculations on data in your tables and add the results to a new column. ? Transformations During Data Flow

Use SAQL to perform manipulations or calculations on data when bringing it in to CRM Analytics.

Introduction Most actions you take in Analytics result in one or more SAQL queries. Every lens, dashboard, and explorer action generates and executes a SAQL query to build the data needed for the visualization. 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. SAQL Null Measures and Dimensions With CRM Analytics, you can use null measure handling to add null as the default value for numeric columns in datasets. Use null dimensions to return grouped null values from your SAQL queries. Analytics SAQL Release Notes Use the Salesforce Release Notes to learn about the most recent updates and changes to Analytics SAQL.

SEE ALSO: Analytics REST API Developer Guide Analytics Dashboard JSON Developer Guide

Introduction

Most actions you take in Analytics result in one or more SAQL queries. Every lens, dashboard, and explorer action generates and executes a SAQL query to build the data needed for the visualization. Analytics evaluates queries, widgets, and layouts to render a dashboard. Behind every widget is a SAQL query which is sent the query engine for execution. The resulting data is passed to the charting library, which renders it using corresponding widget definitions. SAQL is influenced by the Apache Pig Latin (pigql) syntax, but their implementations differ, and they are not compatible.

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download