Have you ever wanted to make an adjustment to a calculation within your Einstein Analytics dashboards to see what the difference would be in real-time? Maybe you want to see what a certain account’s sales performance would be if they grew 23% over the next year. Perhaps you’d like to see what it might look like if you close those cross-sell opportunities and your account starts buying additional products. With Salesforce Direct querying, now you can!
Because Einstein Analytics is typically working from copies of data created through integration or dataflow, it can be difficult to do any dynamic real-time analysis without writing and rewriting a lot of SAQL. We’ll take a look at how you can utilize Salesforce Direct query results to adjust your analysis without needing to rewrite any of your SAQL queries.
For this purpose we’ll create a custom object. Our object will be a master-detail to Account and contain a couple of simple fields:
Our goal is to create a single record related to account that we can use to change the results of an opportunity amount rollup within Einstein Analytics using the “Percent Increase” field. In order to do that, we need to create a dashboard which has a table outputting a roll-up of the prior year opportunity amount by account and create a calculation which adds 10% to it:
Then we’ll need a Salesforce Direct query which returns our percent increase field. We’re using the Phase field so we can create more than one instance and maybe do some comparisons so we’ll use a static step for the Phase filter that matches our picklist values. We can assume our dashboard will always be in the context of a single account record so we’ll filter our query using results from an account filter on the dashboard. Our resulting step looks like this:
Now we can go back and update our previous query to use the results of our Salesforce Direct query (this wouldn’t work if we wanted to see increases over 100% or below 10%, but for the purpose of demonstration we’ll keep it simple with 1.).
We can create a new analysis record now to see how this works. I picked an account that had some prior year data and added the following:
There you have it! We just updated a calculation using an Einstein Dataset in real-time! This is a very simple example, but the applications of this functionality are very exciting. We can extend this much further, utilizing lightning components to pack all of this (the dashboards, the analysis record creation, and other record details) into a single custom lightning app. What’s more, with the lightning event framework you can easily pass dashboard states to update your dashboards in real-time when creating records or navigating through them. We’ll explore more in later blogs!