3 Tips for Tableau CRM & SAQL Beginners

Soobin Kittredge
5 min readNov 7, 2021

Salesforce is trying to allow SQL to be used in Tableau CRM as an effort to attract more traditional data scientists, but just like any other Salesforce-specific language, I had to dig in further when I started learning about Tableau CRM and SAQL.

The fact that the Salesforce analytics visualization tool has been through couple of name changes (Wave → Einstein Analytics → Tableau CRM) it adds an extra challenge when you are looking for resources online.

Followings are the three most useful tips I learned myself past couple weeks learning about Tableau CRM and SAQL without much previous exposure to SQL or data analytics:

1. Adding 4+ datasets to a Lens

If you are using just the UI for creating a chart in Tableau CRM dashboard, you’ll soon notice that it won’t let you add more than 4 datasets as a source.

Easiest way I found adding more datasets to the chart lens was to setup the chart as close you want to make it as possible, then adding new dataset using SAQL editor. Then you’ll need to match the generated SAQL pattern to fit the new dataset into it.

Example Lens: Tasks separated by WhatId and related account’s industry and type

This would be useful if you need to analyze sObject that has polymorphic field like WhatId or WhoId that you’d like to analyze, or dataset that only has sObject ID that you need to connect the different types of sObjects for analysis.

Example above shows 4 datasets all filtered from Task table, separated based on related record’s (case or opportunity) account’s Industry and Type. Bars separated by Task Subtype, and bar segmented by task’s related record’s account’s industry. Above would be what I’d like to see in the dashboard, but I’ll need to add one more dataset — UtilPartnerCaseTask

If I click Query Mode ([>_] button above the chart legend) it shows the current query in SAQL. If you speaks in SQL, then you’ll know what to do! If not, following is what I do:

Initial SAQL generated by TCRM. *file extension is SQL so gist will render syntax highlight*

Warning: Once you start editing, you won’t be able to go back to no-code chart edit mode and labels on chart will change.

Make sure to save this original query somewhere so you can always start again when things go wrong going forward.

First is to add the new dataset. You can add new dataset by clicking Add New Dataset button next to the Run Query button. Also you can switch to SQL if you are not up for SAQL. Once you add the new dataset to the query, just try finding the pattern and add your new dataset data into the cogroup , coalesce and count

Once you update query, click Run Query then go back to Chart Mode to adjust chart as needed.

Datasets now shows 5 datasets that were added to the lens

As long as you name filters and dataset properly/predictably in Recipe, you’ll be able to add in more datasets easily using SAQL.

2. Merging datasets using union

When you need to merge datasets to show a simpler data visualization, you can use union. I couldn’t find a way to do this just using UI, so SAQL editor comes in handy.

Table values for Task count related to each Account Industry seems duplicative, as each rows are mutually exclusive

If an account’s industry is ‘Agriculture’, it will not be ‘Utilities’. Table columns C ~ G shows sort of duplicative data in separate columns and would be nice if we can just show how much tasks exist in each section.

  1. From the loaded table, generate desired columns — example generates 2 columns for grouping (TaskSubtype and Account Industry) and a Task ID that will be counted. Make sure all loaded table generates columns in matching order.
  2. Merge tables by using union
  3. Group table by wanted columns
  4. Generate final table and list grouping and wanted data.

Updated query will show only one column for the task count!

3. Update query from dashboard selection

Tableau CRM’s Advanced Editor will let you easily ‘write’ dynamic query.

Start by creating a text component onto the dashboard, and click ‘Advanced Editor’ — from right side panel or the [>_] button at the bottom right of the dashboard canvas.

This will show the advanced editor. You can select Source Query (target chart that user is expected to interact with) and Source Data.

If you select Data Selection : Cell > Row Index : 0 > Column : target column, it will return the column value of selected cell (= selected bar from bar chart). You can preview data as well. Then make sure you select ‘Selection’ from Interaction Type.

Once you select correct data, click ‘Copy’ in the ‘Created Interaction’ section and paste into where it says Add text... in the widget text editor. Save and preview the dashboard, trying clicking around the bar chart to see the text widget changes value accordingly.

By adding a filter SAQL to previous table, now you can display selected Account Industry’s data on the table.

As a beginner Tableau CRM user myself, hope this can provide a simple guidance on how to get started on Tableau CRM for anyone starting a new journey. ☁️

Helpful Resources:

--

--

Soobin Kittredge

Salesforce Application Architect | Senior Salesforce Developer.