Predictive Analytics with Clicks in Tableau using Einstein Discovery Model

In this blog, we will be discussing embedding predictions from Einstein Discovery into Tableau, using the new extension object available in Tableau Desktop (version 2021.1).

Predictions from Einstein Discovery can be embedded in Tableau by following three easy steps.

Prerequisites: Licenses and Software

  • A CRM Analytics Plus or Einstein Predictions license from Salesforce. If your company’s org doesn’t have this, download an analytics-enabled Dev Org
  • A Tableau Desktop license. If you don’t have this, you can start a 14-day trial
  • Tableau Desktop v2021.1 or later
Step 1 Einstein Discovery Model Creation

Step 1: Einstein Discovery Model Creation

The dataset used for this prediction can be found here (Superstore Sample Data). Upload the dataset into CRM Analytics and create a story.

  • Field to Analyze: minimize ‘Days to Ship’
  • Story type: Insights & Predictions
  • Select “Automated” to let Einstein pick relevant fields for you

If you have not created an Einstein Discovery model before, please refer to this blog (https://www.springml.com/blog/my-einstein-discovery-toolkit-3-tips-to-get-started/) to understand the various parts of a story and steps to optimize a model (optional). At the very least, your model needs a few variables that have some correlation with the output.

Step 1.1 Einstein Discovery Model Variables Correlation

Step 2: Create a Tableau Workbook

Now, we need to build a Tableau workbook with the same data set used to build the predictive model in Salesforce. You can download a partially completed Tableau Workbook here (location to download the dashboard without extension) to follow along with the steps of this tutorial. Watch our screen recording or follow the steps mentioned below to create a hidden Data Sheet and use it in the dashboard.- Step 2 – Adding a hidden data sheet

Step 2 Create a Tableau Workbook
  • Partially completed Dashboard preview. We will be adding the Einstein Discovery Extension in the blank space on the right side of the Dashboard
Step 2-1 Create a Tableau Workbook Einstein Discovery Extension
  • Create a new sheet in Tableau
  • From the Data pane on the left search for the variables. Then drag and drop in the “Text” box in Marks Card as shown. Name the sheet “Data Sheet”
  • Add the Data Sheet to the dashboard. Make it floating and hide the sheet in the dashboard by setting its height and width to 1
  • Create an ‘action filter’ to filter the data sheet when selections are made in other parts of the dashboard

Step 3: Embedding Einstein Discovery Model in Tableau

Before we can create the extension, we need to authorize a connection between Tableau and Salesforce.

  • In Tableau Desktop select Help > Setting and Performance > Manage Analytics Extension Connection and select Einstein Discovery to enable extension connection to a Salesforce from Tableau
Step 3-1 Embedding Einstein Discovery Model in Tableau
  • A Salesforce access window will open in the browser directly and prompts to select the username to grant access for Tableau Desktop to communicate with the Prediction Model
Step 2-1 Create a Tableau Workbook Einstein Discovery Extension
  • Create a new sheet in Tableau
  • From the Data pane on the left search for the variables. Then drag and drop in the “Text” box in Marks Card as shown. Name the sheet “Data Sheet”
  • Add the Data Sheet to the dashboard. Make it floating and hide the sheet in the dashboard by setting its height and width to 1
  • Create an ‘action filter’ to filter the data sheet when selections are made in other parts of the dashboard
Step 3-2 Embedding Einstein Discovery Model in Tableau
Step 3-3 Embedding Einstein Discovery Model in Tableau

Now we can set up the extension

Step 3-4 Embedding Einstein Discovery Model in Tableau
  • Drag an Extension Object from the Object Shelf into the Dashboard. Select the Einstein Discovery extension and add it to the dashboard
Step 3-5 Embedding Einstein Discovery Model in Tableau
  • A configuration window will pop up. Select the Prediction definition (Predicted Days to Ship) we created in Step 1 and then the worksheet (Data Sheet) we created in Step 2 with all the variables we used in the model. Then click “Proceed”
Step 3-6 Embedding Einstein Discovery Model in Tableau
  • Verify all of the variables in the Workbook match to the variables within Salesforce and click “Next”
Step 3-7 Embedding Einstein Discovery Model in Tableau
  • Enter a label, units, and summarization function for the predictions. After making your selections click on the “Done” button. The prediction is now deployed in your Tableau desktop
Step 3-8 Embedding Einstein Discovery Model in Tableau

Thanks to the hidden Data Sheet, whenever we make a selection in the rest of the dashboard our predictions will be updated automatically

What’s Next: Advanced Use Cases

Einstein Discovery predictions can be embedded into Tableau Calculated fields directly, and can be used in the visualizations. Follow along with this video or follow the below steps for creating a calculated field in Tableau using the Einstein Discovery Prediction:

Advanced Use Cases-Case 1
  • In Salesforce Analytics Studio > Model Manager > Predicted Days to Ship (Model created for this blog) > settings > Create Tableau Table calculation
  • Copy the table calculation from the pop up window
Advanced Use Cases-Case 2
  • Create a Table Calculation in Tableau and name it “Predicated Days to Ship”. Paste the code from the previous step in the editor and click on the “OK” button to save it
Advanced Use Cases-Case 3
  • You can now use the calculated field “Predicated Days to Ship” to find the outliers in state by postal code and manufacturer

Now that we have seen how easily we can embed the predictive model in Tableau, let us see the limitations we have with the current dashboard extension.

Limitations:

  • Worksheets allow you to get predictions for one or more rows of data (bulk predictions). You can get bulk predictions for up to only 50,000 rows of data at a time
  • Parameters allow you to conduct interactive, “what if” predictive analysis on a single set of input values

You now have your new embedded predictions in Tableau that will enable the end-user to have the power of predictive analytics with just a few clicks while eliminating codes that require more effort. The outcome is to give the user the best of both worlds of Salesforce and Tableau.

Thought Leadership