Start tracking your progress
Trailhead Home
Trailhead Home

Use Bindings to Compare Data

Bindings to the Rescue

The director wants a way to quickly compare each team members’ fundraising results against the average. That way, we can get an idea of where to focus resources. The way to do that: Draw a line representing team average in the chart that shows every member’s fundraising total. Then you can see right away who’s above the line and who’s below.

But how do you set the line to a calculated average? The answer: Bindings!

Hello, Bindings, My Friend

Remember algebraic equations, like y = 2x + 1? The output variable (y) varies based on the input variable (x). Well a binding works the same way—a binding has an input and output. Based on the binding, you can use an input step to determine an output, which can either be another step’s results or the setting for a widget property.

The value provided by the input step is based on the binding type. There are two types of bindings: selection binding and result binding.

  • Selection binding returns the selections in the input step to the output component. Selection bindings are interaction-driven, where the result is evaluated each time the user makes a selection in the dashboard. For example, when a user selects the Top 5 toggle, a chart shows the top 5 accounts.The "Top 5" option is selected in the toggle, resulting in the top 5 accounts showing in the bar chart.
  • Result binding uses the result of the input step to update the output component. For instance, think of a chart that displays an average reference line based on a calculation from another step.The results from Query 1 appear in the number widget and are also used to determine the reference line in the chart.

Compare Account Owners Against the Average

The Top Account Owners chart shows large differences in total opportunity amount per account owner. To determine how each account owner compares against the team’s average, let’s add a reference line that represents the average. It just so happens that the Account Owner Avg number widget, found on the left column of the dashboard, already calculates the average. So let’s share the results between widgets! The Leaderboard page has the Account Owner Avg widget and Top Account Owners widget called out in red.

To show the average as a reference line on the chart, we have to bind the step results from the Account Owner Avg widget to the Top Account Owners chart. But before we can add the binding, we need to know the expected JSON first. (Bindings require you to modify the dashboard JSON.)

Determine the Expected JSON Structure

Let’s start by creating a reference line with a fixed value. Later, we can replace the fixed value with a dynamic one—the binding.
  1. Open the Leaderboard page.
  2. Select the Top Account Owners chart widget.
  3. Add a reference line based on a fixed value, 30 million. Set label to Avg..
    In the X-Axis (Top) section of the widget properties, click + Reference Line, and add a reference line with the following settings:
    Widget Property Value
    Value 30000000
    Label Avg.
    The reference line appears at 30 million in the Top Account Owners chart.
  4. Save the dashboard.

The chart now shows the reference line at 30 million.

Replace the Fixed Value with the Result Binding

To dynamically set the reference line based on the account owner’s average, use a result binding to replace the hardcoded value (30,000,000) with the calculated average in the Account Owner Avg widget.
  1. Find the step ID of the input step, the one associated with the Account Owner Avg widget.
    1. Select the Account Owner Avg widget under KEY METRICS.
    2. Click the Step tab in the right pane.
    3. Take note of the ID at the top of the right pane. In this case, it’s Account_Owner_1. We need to reference this input step by its ID in the binding.
      The ID is highlighted for the Account Owner Avg. widget with a red line pointing from the edit pane to the widget on the left.
  2. Select the Top Account Owners widget and take note of the widget ID. We need the widget ID to locate the widget in the dashboard JSON. We’ll add the binding to the reference line defined in this widget’s properties in the dashboard JSON.
    In this example, the widget ID is chart_3.
    The ID for the Top Account Owners widget is highlighted in the edit pane, indicating chart_3.
  3. To view the dashboard JSON, press Ctrl+e for Windows or Cmd+e for Mac.
  4. Search the JSON for 30000000. To open the search bar, press Ctrl+f for Windows or Cmd+f for Mac.
    "chart_3" is called out with a red arrow in the JSON, and the "referenceLines" section is highlighted with a red rounded rectangle.

    If scroll up, you’ll see that this value is set for the widget with ID chart_3—this is the Top Account Owners widget.

  5. Replace 30000000 with the following binding.
    "{{cell(Account_Owner_1.result, 0, \"C\").asString()}}"
    The new "value" line in the JSON include the new binding and is highlighted with a red rounded rectangle.
    Let’s review this binding for a moment, shall we? As you may already have figured out, this binding returns the average total opportunity amount per account owner from the Account Owner Avg widget.
    • .result specifies that this is a result binding (as opposed to a selection binding).
    • cell(Account_Owner_1.result, 0, \"C\") returns the result from the Account_Owner_1 step. Specifically, the cell data selection function returns a single cell of data, located at row 1 (row with index 0), column C from the step results.


    To preview a cell’s value, view the step’s results in tabular form in the SAQL editor. Looking at the results of the Account_Owner_1 step query, you can see the value of the cell at row 1, column C—this value is the account owner’s average.The SAQL editor shows the results of the Account_Owner_1 step.

  6. Press Cmd+e or Ctrl+e to view the update in the dashboard. In the Leaderboard page, notice that the Avg reference line in the Top Account Owners widget moved from $30 million to around $42 million.
    The new average line is highlighted, pulling the data from the Account Owner Avg widget.
  7. To ensure the average doesn’t change when users make selections in global filters or widgets that cause faceting, select the Account Owner Avg widget, select the Step tab in the right pane, and verify that the Apply global filters and Apply filters from faceting step properties are deselected.
    In the step tab of the Account Owner Avg widget edit pane, Apply global filters and Apply filters from faceting are deselected.
  8. Save the dashboard, but this time, rename it to Worldwide Fundraising Final.

Wrap Up

At the next monthly All Hands, the program director shared the new version of the Worldwide Fundraising dashboard with ABC Seeds team. The director clicked through the dynamic pages that you added, showing off each page’s insights. While showing the Leaderboard, she congratulated the top account owners for generating a healthy donation pipeline—Irene and Johnny clearly standing out. As soon as the director opened the Donations page, the room immediately cheered. The $500 million goal is within reach. Time for ABC Seeds to determine which new schools to fund next!

When you can get these reactions within seconds of opening a dashboard, you know you’ve built an effective solution that’s easy to read. Congratulations to you, too! Stand up and take a bow (or that much needed stretch). We hope to see you back on the Einstein Analytics trail soon!