Connecting Dataset in Wave

If you like me have been building dashboard in Wave for awhile, then you probably would agree that best practice is limiting the usage of multiple datasets. One of the main reasons for this is that the natural faceting that makes widgets interact with each other will stop working. Traditionally you would have to add selection binding in the dashboard JSON in order to make sure that selections worked across datasets and thereby widgets. Lately, this has been made a lot easier and you don’t have to be a JSON wiz as you can connect dataset within the UI. So how is this done?

In my example I am using two datasets; one with opportunities and one with cases. I’ve created a list selector with industry and and one for Year-Month as well as a date selector. Obviously, you wouldn’t in your dashboard have two ways of selecting dates. However, I’ve seen both used and they can cause a little trouble, which is why I have added them to this example. But more about that later.

Connecting Datasets

When you are in the flex designer click on the three dots and select “Connect Data Sources”.

We want to add three connections one for industry, one for date in the date selector and one for date in the list selector. First click on new connection, give it a name.

Then choose data source 1, select the first dataset and find the industry field and do the same for data source 2. Finally, save your connection.

Repeat the steps for the date selector and date list selector. And you should end up with three connections like below.

Now when you view your dashboard and select a industry in the list you can see both widgets filter based on your selection. If you select a date, it however does not filter. In order to make this work we have to make a few changes in the dashboard JSON.

Connecting Date Fields (Date Selector)

If you switch to the dashboard JSON (command+E or control+E) and fin the dataSourceLinks section, it should now look something like this:

 "dataSourceLinks": [
 {
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "AccountId.Industry"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "AccountId.Industry"
 }
 ],
 "label": "Industry",
 "name": "Link_2038"
 },
 {
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate"
 }
 ],
 "label": "DateSelector",
 "name": "Link_2056"
 },
 {
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate_Year"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate_Year"
 }
 ],
 "label": "DateListSelector",
 "name": "Link_177"
 }
 ],

In order to make the date selector work you would have to remove the _Year from the date field names in your linking. I called my data source link “Date”, so I’ll find that linking in the section  and remove _Year from both field names. This is how the instructions look before the changes:

{
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate_Year"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate_Year"
 }
 ],
 "label": "DateSelector",
 "name": "Link_2056"
 },

This is how it should look after removing the _Year:

{
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate"
 }
 ],
 "label": "DateSelector",
 "name": "Link_2056"
 },

If you now select a date in the date selector you will see that both widgets are reacting to the date(s) selected. However, this will not fix the faceting if  you are using your date in a list selector.

Connecting Date Fields (List Selector)

In order to get my list selector for Year-Month working I need to define the Year-Month definition in the data source link. Find the DateListSelector in the dataSourceLink section. It will look like this:

{
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate_Year"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate_Year"
 }
 ],
 "label": "DateListSelector",
 "name": "Link_177"
 }

Just as with the date selector we need to make a change the the field name, as we want to look at a specific combination of Year-Month. This is done by using the SAQL version of the date combination: CloseDate_Year~~~CloseDate_Month and ClosedDate_Year~~~ClosedDate_Month. The JSON should look like this:

{
 "fields": [
 {
 "dataSourceName": "Opportunity_with_Account_and_Campaign",
 "dataSourceType": "saql",
 "fieldName": "CloseDate_Year~~~CloseDate_Month"
 },
 {
 "dataSourceName": "Cases1",
 "dataSourceType": "saql",
 "fieldName": "ClosedDate_Year~~~ClosedDate_Month"
 }
 ],
 "label": "DateListSelector",
 "name": "Link_177"
 }

Now your list selector should work. Remember if you are using Year-Month-Day, Year-Quarter or Year-Week you would have to use that combination in the field name:

  • Year-Month-Day: CloseDate_Year~~~CloseDate_Month~~~CloseDate_Day
  • Year-Quarter: CloseDate_Year~~~CloseDate_Quarter
  • Year-Week: CloseDate_Year~~~CloseDate_Week

3 thoughts on “Connecting Dataset in Wave”

  • 1
    Dipak Hirani on December 8, 2017 Reply

    That’s a great help and thanks for taking this procedure step by step –

    When combining the 2 datasource is it possible to display the values in one combination chart.

    I have the filters working and they change 2 different charts. chart 1 shows Quota by month and Won/stage business shows by month. If I want to superimpose the Quota line into the Won/Stage graph how would I do this?. (Save me space on the dashboard)

    • 2
      Rikke on December 10, 2017 Reply

      Thanks for the feedback.

      Now I don’t know how you have set up your charts, but you could do a dynamic reference line or dynamic target. You would do this by having a hidden step for your quota and do a result binding on you won amount chart. I wrote a blog taking you through how to do this with a gauge chart: http://www.salesforceblogger.com/2017/06/19/how-to-make-your-gauge-chart-dynamic/

      Hope this helps.

  • 3
    Marta on April 6, 2018 Reply

    Thank you very much!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.