A results binding in Salesforce Analytics Cloud

A Results binding is used to filter a step using the values resulting from another step. In the example below we want to see the average delay for the top 5 carriers in the OnTime Dataset.

I have the full list of Carriers on the left.. I am going to limit the results to the top 5 carriers and I want to see the Average delay time change from the average delay time across all flights in the dataset to only showing the delay time for the top 5 carriers.

Step 1:

Using the dataset OnTime as per previous blogs.. Dataset can be found HERE. I have added two lenses to a dashboard, One dashboard is a grouping of all airlines and their flights in the dataset and the second graph is the average delay time across these carriers and also the total dataset.

Looking at the dashboard JSON you can see that the two steps and two widgets can be seen as a simple grouping of Carriers based on the count of rows / number of flights, and also the average of delay time across all of the flights. I have added the below JSON so you can use this as a reference when in the next few steps JSON is added for additional adjustments to the steps.

Step 2 : I then want to quickly have an overview of the carriers with the most flights and to do this I add desending parameter in the step showing each of the carriers. This is shown in the below code:

Once the above code is added to the carriers step, the graph reshapes and apply's in descending order each carrier and their total amount of flights / count of rows.

Step 3: I now want to limit the results of the groupings of all the carriers to only show in the graph the top 5 flying carriers. This can be seen below on the left handside in the below image, The code for this step is also below. This is done by using the limit function in the query section of the step.

Step 4 : Using the results of the Carrier graph we now want to specifically filter the second graph by the results on graph 1.

Currently the average departure delay shown is across the OnTime dataset, once the results bind is applied as a filter on graph 2 the average wait time will be bound to the specific results of graph 1. In the case of this dashboard graph 2 will be now filtered by the top 5 carriers by number of flights. To do this we add the following results binding to the step as a filter:

"filters": [["Carrier", "{{results(Carrier_2)}}"]]

UPDATE - This is new syntax for Bindings 2.0 below:

With the above code added to the step the results of the binding now show that the top 5 carriers have a higher departure delay across this dataset as shown in the below image. As the data changes and more carriers and flights get added to the data the average departure delay time will adjust dependant on the top 5 carriers.

Code for the whole dashboard can be found below: