Better Together, Einstein Predictions in Tableau

There is a huge potential for opportunities with collaborative efforts between Tableau and Einstein. Tableau has been popular with high adoption for years now, with easy to build and consumable business reports and dashboards. Salesforce has nurtured Einstein Discovery and other products in the Einstein ecosystem with very powerful AI-enabled CRM Predictive analytics features. This opens up new horizons, and more importantly, increases the reach and effectiveness of Analytics Solutions built around the promising suite of Salesforce Analytics tools. It may mean different things to different customers but for traditional Tableau Customers, Einstein Discovery and Analytics offer the added advantage of Predictive Analytics with point and click enablement, and use cases such as Predictive Churn of Accounts or Opportunity Scoring to help the Sales Teams grow their business. You don’t need a heavy data science team to build these predictions, and Business Analyst/Data Analysts with a keen understanding of business and data can create robust Machine learning Models and Predictions, all on their own.                 

With all this said, we totally endorse this idea of collaborations between these amazingly powerful tools to drive Data Analytics, both predictive and descriptive. Also while using Einstein products for Salesforce Users leads to effective utilization and success, not every User is in Salesforce. This is where Tableau comes in, yielding a collaborative and successful approach towards Analytics Solutions for businesses. At SpringML, we are actively taking steps towards these collaborations, with integrations that can help us achieve each product while enriching the other with added inherent features.

Einstein Discovery & Analytics Wave Rest API and Prediction API can be leveraged to use Predictions made in Einstein Discovery and use them in Tableau for further analysis through Tableau reports and dashboards for Business Users, who are more comfortable with Tableau. Our initial integration efforts attempt to use the Predictions made with Einstein Discovery using Salesforce data and to enable Tableau Users to consume them.

Einstein Discovery: Opportunity Scoring

In this demo, we used an ‘Opportunity Scoring’ use case that lets businesses gauge how healthy their Opportunity Pipeline is. Through Einstein Discovery’s use of Logistic Regression Modelling, we are able to push the Predictions enabled Einstein Analytics dataset to Tableau for end-user analysis.                       

Einstein Discovery: Opportunity Scoring

This Discovery Model scores Opportunities that reflect the likelihood for it to be Closed Won, as the logistic regression tries to maximize the Closed Won chances. Once we ensure this Model passes the threshold parameters (Cross-Validation, Model accuracy, No Leakage, removing bias and Overfitting, etc), we go ahead and deploy the Model.                     

Einstein Analytics: Prediction Transformation

Once we deploy the Model, we use the Prediction Transformation [1] in Einstein Analytics Dataflow to score an Opportunity dataset (which is built like a regular Einstein dataset by digesting SFDC Object Opportunity, but with added Prediction Transformation that refers the Prediction Definition [2 and 3] of the Model we created). The result of this Transformation node is a Scoring Field [4] that holds the Scores of Opportunities.

By studying the patterns in data and with regression techniques, the Model is able to assign a score to the Opportunities in the dataset.

Data Extraction: REST API GET Calls
We can execute the next steps in many different ways using POSTMAN (an API enablement tool) or a Python script. We use this Python script to make these API calls to Einstein REST API, and extract the Einstein Predictions enabled dataset (Other options can also be used instead of batch scripts. For a more UI approach we can use Postman, an API services enablement tool). Once we extract the data in a nested JSON format, we need to clean the data format to a more digestible format, such as csv. We use Data Frames for this purpose, and in order to extract this data in Tableau, we need to host this data in a Database layer that can be imported to Tableau using Tableau Connectors.

Database layer – Google BigQuery/Postgres:
Postgres, Google BigQuery or any API enabled database options can be used for this purpose. We used BigQuery for this demo, but also created working solutions using Postgres. Although Postgres being open source should be sufficient, we saw that BigQuery showed improved performance when used instead of Postgres.

Database layer Google BigQuery

Learn more about the GitHub import libraries and API calls. Once in BigQuery, choose the Project and Table that we are calling through the API’s in Python Script. We have successfully hosted data in BigQuery at this point, all that is left is to create a connection in Tableau using the Tableau Connectors for BigQuery/Postgres (depending on your Database choice). Running the final cells in the Python Script creates a Live Connection and Dataset in Tableau, ready to be consumed in Tableau Reports and Dashboards as seen below.

What’s Next: Advanced Use Cases
In next iterations, we are working on using Einstein Prediction’s API to score the data in Tableau or external Salesforce data directly. That way, we can build the models in Einstein Discovery and use the learnings to score data which is entirely external to Salesforce (with similar Variables/Fields and data formats).

We are exploring many other potential use cases, which would create incredible value in this new Einstein-Tableau co-space. Our team is currently working on using Tableau Extensions to integrate lightning components onto Tableau directly, so end users can look at Einstein scorecards with recommendations in Tableau itself. Stay tuned to the SpringML Blog space as we have a follow-up post coming out soon, exploring our next iterations with Tableau Extensions and Einstein Lightning Components.