Account Hierarchy Rollup in Einstein Analytics &

The power of Einstein Analytics is the ability for end users to have set of facetable , on platform and externally sourced data embedded anywhere on the Salesforce platform. With this we create actionable widgets where an end user can focus, gain context and intelligence right where they are working.

Nothing is more important to a Salesperson when they jump to an opportunity page or Account page is it to see a “Customer 360 View” so that they are informed about, current cases or number of cases , whether the account has paid its latest invoice and what the Accounts competitors are doing when interacting with your company.

With this a large amount of Enterprise companies have Parent Accounts in Salesforce with Subsidiaries. They want to be able to see information in aggregate and for the specific account on the same page.

For example Total Products, or Opportunities or CSAT and NPS scores.

In the below video is an example of what you should the bottom of the Hierarchy you see only information or rows at the lowest level.. but as you go up the hierarchy you will see everything below it.


To achieve this result we start with bringing in the data required to build the hierarchy into Einstein Analytics. We build out a dataflow that looks like the below:

Screen Shot 2017-10-14 at 4.25.11 PM.png

In the above diagram we are breaking down a couple of key actions into individual nodes.

  • Node 1 - We digest the Account Object, with the fields Id, Name
  • Node 2 - We Augment AccountId with the Accounts ParentId
  • Node 3 - We flatten the ParentID's onto each row
  • Node 4 - We digest the Opportunity Object with the fields Name, ID
  • Node 5 - We Augment the Flattened Account Node with the Opportunity Digest with a left Join based on the Opportunity and Account ID's
  • Node 6 - Register of Dataset of the output of Node 5.

The JSON for the Dataflow can be found below:


There is also an extra bit of code in the Node 2 Code. We also added the ability for the Flatten Columns to be viewed in the UI or in Einstein Analytics. Really good for diagnosing issues and viewing the hierarchy in detail. The extra code that was added is seen below between the Schema brackets in the node Json. It is the parameter isSystemField: False


Once the dataset has been registered we can now drill in an see the columns and see the information that has been brought into Einstein Analytics. In the below Images we can see the number of Opportunities as this is the granularity of the dataset, with the Account Name at the row level and the appropriate Parent Account for that given Account. For example you can see here.. Vand Enterprises.Inc--> Permadyne GmbH LTD ----> Vand Enterprises

This is good news... We can now start to build out a dashboard for Account pages. In this example I want to keep it really simple and just list the opportunities and the Account Names that are rolled up as per the hierarchy. I have two graphs on the page layout. One with the dataset grouped by the Opportunity Name, the other with the hierarchy role field and the Account Name

The dashboard JSON I have used can be found below:

We can now add this into our page layout. In this example we are going to add to the Account page layout. To do this goto your page layout, click on Cog in the top right hand side of your page, and click on Edit Page. You will now be brought into the Lightning App Builder where you can add a "Wave Dashboard" component. Once this is added choose your dashboard and it will embedded into a page layout. The next thing to do is then filter this dashboard based on the Account shown on the page layout. To do this we use Filter option shown below on the right handside. Syntax for the filter can be found in Einstein Analytics documentation here

Screen Shot 2017-10-14 at 7.14.56 PM.png

The example of the filter that I have used in my page layout is below:

Once this is complete.. you should be able to go through the Hierarchy and see only rows applicable to account hierarchy as per video at the top of the page.