Einstein Analytics Summer ’17 – Nested Bindings

If you skimmed through the release notes for the Summer ’17 release of Einstein Analytics, you may have unintentionally missed a new feature available – Nested Bindings. We touched on this briefly when we reviewed the Summer ‘17 release a few weeks ago, but today we are going to go into more detail. This feature affords you the ability to manipulate and display your data in ways previously difficult or not possible. There are a few different scenarios that we will walk through to demonstrate the power nested bindings provides.

Two Static Selectors and One Chart

For this example, we will look at creating two static steps that work with each other to change the grouping of a final SAQL step. We want two widgets, one to change the grouping by month or by week, and another widget to decide whether to group opportunities by the first widget or to group by opportunity and account instead. We would accomplish this by creating 2 static steps

selector_1

“values”:[

{

“display”: “Monthly”,

“Grouping”: “Group_Monthly”,

“Generation”: “Generate_Monthly”

},

{

“display”: “Weekly”,

“Grouping”: “Group_Weekly”,

“Generation”: “Generate_Weekly”

}

]

selector_2

“values”:[

{

“display”: “Opportunity_by_date”,

“Group_Monthly”: “(‘date_Year’, ‘date_Month’, ‘Opportunity’)”,

“Generate_Monthly”: “‘date_Year’ as ‘date_Year’, ‘date_Month’ as ‘date_Month’, ‘Opportunity’ as ‘Opportunity'”,

“Group_Weekly”: “(‘date_Year’, ‘date_Week’, ‘Opportunity’)”,

“Generate_Weekly”: “‘date_Year’ as ‘date_Year’, ‘date_Week’ as ‘date_Week’, ‘Opportunity’ as ‘Opportunity'”

},

{

“display”: “Opportunity by Account”,

“Group_Monthly”: “(‘Account’, ‘Opportunity’)”,

“Generate_Monthly”: “‘Opportunity’ as ‘Opportunity’, ‘Account’ as ‘Account'”,

“Group_Weekly”: “(‘Account’, ‘Opportunity’)”,

“Generate_Weekly”: “‘Opportunity’ as ‘Opportunity’, ‘Account’ as ‘Account'”

}

]

With these two selectors created, we can now create our chart. This chart will dynamically change based on your selections.

chart_1

q = load \”dataset_1\”; q = group q by {{column(selector_2.selection,column(selector_1.selection,[\”Grouping\”])).asObject()}}; q = foreach q generate {{column(selector_2.selection,column(selector_1.selection,[\”Generation\”])).asObject()}}, count() as ‘count’;

One Static Selector and Multiple Charts

In this scenario, we want to be able to group a chart using a static selector. However, we also want to be able to filter a second chart by what we select in the first chart. To do this, we can use nested bindings! Let’s set up our static selector first:

selector_1

“values”:[

{

“display”: “Industry”,

“Grouping”: “Industry”

},

{

“display”: “Country”,

“Grouping”: “Country”

},

{

“display”: “Year”,

“Grouping”: “date_Year”

},

{

“display”: “Account”,

“Grouping”: “Account”

}

]

 

Next, let’s create the chart that is bound to that static step.

chart_1

q = load \”dataset_1\”; q = group q by ‘{{column(selector_1.selection,[\”Grouping\”]).asObject()}}’; q = foreach q generate ‘{{column(selector_1.selection,[\”Grouping\”]).asObject()}}’ as ‘{{column(selector_1.selection,[\”Grouping\”]).asObject()}}’, count() as ‘count’;

Once those two steps are created, we can now create the second chart, which will be filtered by whatever the user selects in chart_1.

chart_2

q = load \”dataset_1\”; q = filter q by {{column(chart_1.selection,column(selector_1.selection,[\”Grouping\”])).asEquality(cell(selector_1.selection,0,\”Grouping\”))}}; q = group q by ‘Product’; q = foreach q generate ‘Product’ as ‘Product’, count() as ‘count’;

Final Thoughts

In the 2 scenarios above, we explored using nested bindings in a simple way with the hope that this can be a starting point for you to create more complex queries. Dynamically changing columns in tables and binding multiple charts with various dependencies without the use of faceting have now become much easier to do!