Co-grouping with clicks not code
Not long ago I took you through co-grouping in my SAQL series, while SAQL is good to know especially when you want to do really advanced stuff, there is no reason why it has to be complicated and in Spring 20 it isn’t (I guess Safe Habour still applies). With clicks instead of manually writing SAQL you get the option of co-grouping aka data blending – all in the UI. So I’ll show you this new capability in this blog, however, I would still recommend reading part 4 of the SAQL series, so you understand what cogroup really does.
You first need a setting
When your org has been upgraded to Spring 20 – I am currently using my pre-release org – you first need to go to the analytics settings in setup and click the checkbox next to “Enable data blending for Einstein Analytics explorer” and of course save it.
Click, click, click… data blending
Alright, the use case is simple, how many cases and opportunities do an account have. We will be using the “Opportunity” and “Case’ dataset from the Sales Analytics templated app.
First, find your case dataset and open it up in the explorer, you will notice there is now a new option in the top left corner where you see the dataset name to add a dataset.
Now click on the “Add Dataset” in order to find the ‘Opportunity’ dataset and add it to the query.
As you can see from the gif above be default we get a “Left Blend” or left co-grouping – if you are unsure what this means go ahead and read part 4 of the SAQL blog series. The case dataset is our primary dataset as we loaded this first, hence it is also our left table. Since we are interested in keeping accounts from the left and the right side we will change this to an “Outer Blend” by clicking on the edit button.
Next up we need to decide the grouping and measure. Let’s first add a measure. We will do that like any other time we are adding a measure by clicking on the “+” sign under the ‘Count of Rows’ from the case dataset, notice that the dataset is mentioned underneath the measure. When you click to add a new measure you will see measures from both datasets, I’ll be scrolling down and selecting ‘Amount’ from my opportunity dataset.
Now we just need to add the grouped field ‘Account Name’. So click on the “+” un the “Bars” section. You’ll notice both datasets are available to select a grouping from, you will need to find the matching column ‘Account Name’ in both drop downs.
And that’s it. You can now modify the formatting of your chart to look the way you want and not worry about maintaining SAQL.
Do note that you can always switch and see the SAQL in the query mode, but remember if you make changes and click “Run Query” this will forever be a SAQL query and you do need to make all further changes directly in SAQL.
2 thoughts on “Co-grouping with clicks not code”
Hi Rikke, first of all your posts are awesome.
I was wondering where the date values go when cogrouping. I can’t filter on date fields within the query and I get an error message when using a Global filter on date (This widget can’t be displayed because there is a problem with its source query: Measure range should be a tuple of number, number).
I need to bind the co grouped datasets. Is this possible?
Hi Rikke! Thank you for this! One question, once I’ve grouped, I no longer have the option to “add formula” when selecting a measure. Am I doing something wrong?