Pages

Sunday, November 18, 2018

Einstein Analytics: One-to-Many Relationship with Power of 1

A few months back, we write a blog on handling multi-select picklist value from Salesforce in Einstein Analytics, multi-select picklist value will flow to Einstein Analytics, but you cannot see the value in Table, but you still can filter it normally.

First use case:
Count the number of children record from a parent, example: number of won opportunities of an Account. I know we can easily use the roll-up summary field in Salesforce, but in case you do not have the power to add a new field, or it is a lookup relationship, where you cannot create a roll-up summary field.

For this use case, I am using Power of 1 in Einstein Analytics as the solution.

1. computeExpression
In the child object before augment with the parent object, add a computeExpression node and a compute field called "PowerOf1"

This will simply return 1 for each child record.


2. augment node
The left source would be the parent object, and the right source is the child object. This is similar normal many-to-one augment, but for Operation, select Look Up Multiple Values.



3. The Moment of Truth


Using Lookup Multiple Value operation, PowerOf1 field (numeric) will be added, in this case, it would be the numbers of opportunities record (as each record is 1). While Opportunity Name will show only 1 name selected randomly, this is similar to how multi-select picklist values works.  Let us see how it is actually stored at the backend:



Second use case
Show the number of children from the same parent in the child object.

This is the same as the first use case, but you need to add another augment, the left source would be the child object, while the right source would be the augment of parent-child contain the power of 1 value.



And this is the result:



ReferenceSpecial Cases for Matching Records with the augment Transformation


Page-level ad