Trending Snapshot with Einstein Analytics

Welcome to an article about articles 🙂

We had good fun discovering Einstein Analytics recently. One of the use cases that seemed to take longer than expected was to provide a visual dashboard to a content manager about the consumption of knowledge articles.

The context for it was to be able to organise the workload of content to update so it can be prioritised by focusing the efforts on the most trending articles. Specially those served in a customer community.

There is an appexchange app that gives you tons of communities reporting, and it’s a great start. Although there you can see daily views, you can’t then break them down by article.

So we headed off to explore Einstein Analytics. Once you have enabled analytics you can create a trend report from a button within a Salesforce report (here’s how). Although this was a step in the right direction, it didn’t give us the manoeuvre we wanted as it registers the data directly from Salesforce report into a DataSet with no Dataflow involved (and that’s where you normally perform transformations).

When you are in this position, your next logical step is to check the Templated Apps.

Have a good look at the options there, and I’d argue it’s where you should always start, rather than doing anything from scratch.

The reason for that is that using templates is how you get the quickest value, and time to production for your use case.

One of the templates its called Snapshot Analytics, which is perfect to analyse how data behaves over time.

In the above section generally for other Templated Apps, you have as the first option to start with the basic or as the second a more advanced one. Here being a Snapshot report is asking you to either choose from an existing DataSet or from Salesforce Objects.

For us in this scenario we needed to select the Knowledge articles.

Now we can then select which object we want to be trending on. Then, we let it do its magic.

Below is our DataFlow: this is what contains instructions to create a dataset plus transformations. They can run either by scheduled time or manually ‘run now’. With DataFlows you can: add fields, edit field properties, run transformations like computer expressions, filter etc.

It’s initially created from that templated app we have just used.

We added to it the GetArticleVersion from a digest, from Salesforce objects, basically to enrich the dashboard by bringing data from Salesforce, in this case the latest article Title.

We applied a filter as we only cared about the latest published article version, and with an augment we enriched the existing transformations.

** Important note on Articles is that with the migration to Lightning Knowledge, when later we enrich the DataFlow make sure you select the objects ending on __ka and __kav (I believe it stands for KnowledgeArticle and KnowledgeArticleVersion)

It’s here where you can see the output details of the very last step where we registered it all into the DataSet: which is a collection of related data that is stored in a denormalised, yet highly compressed, form that is optimised for interactive exploration.

But that wasn’t all: when building the Dashboard widget to visualise the views change day by day, the lines looked flat!

As you can see the Total Article views are so high that a difference between 1 million total views on day and the next to 1million and 500 views it’s not really perceived.

So here is where we look at compare tables and Windowing Functions:

Firstly there’s one called Period over Period, which sounds just what we needed (This video is a great explanation:

The only issue here is that when we created a second grouping with the Article Title the figures went all crazy.

Aha! But there’s another one called Change from Previous. And a big shout out to Daniel Stange who pointed me to check the other functions (why I was so fixated with Period over Period remains a mystery).

We used the function of coalesce to replace nulls with a default value, which came in handy as the first grouping initially showed “-“, with coalesce we set it to “0”.

Then we were ready to transform the data table into a chart, we grouped axis by date and changed the view, then added lines by the article title.


I hope this is a useful reference. It took us some time, but if you have the data: it’s the art of the possible with Einstein Analytics.

Leave a Reply

%d bloggers like this: