---
schema_version: "1"
id: 24227f13b05b8f649bd668df18cfa6a6f461f5bd3c3be553127e5be36716549f
title: Traverse Multiple One-to-Many Relationships in Salesforce Spiff
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/sales/264-0-0/spiff_relationship_traverse.md
canonical_url: https://help.salesforce.com/s/articleView?id=sales.spiff_relationship_traverse.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: cce9fe7f9d29ee2213f0060a7b74e97340b405cce72a6c52bcedc096f10f7b73
description: Return data for an object that's separated by multiple layers of a relationship in Salesforce Spiff.
products:
  - Sales Cloud
  - Sales Enablement
release: "264"
---
# Traverse Multiple One-to-Many Relationships in Salesforce Spiff

Return data for an object that's separated by multiple layers of a relationship in Salesforce Spiff.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available for an additional cost in: <strong>Professional</strong> Edition with Web Services API Enabled</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d40669e77">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d40669e77 ">To create a data relationship:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d40669e77 ">
              <p>A Spiff <a href="https://help.salesforce.com/s/articleView?id=sales.spiff_users_roles_and_permissions.htm&amp;release=264.0.0&amp;type=5" title="Give users the appropriate level of access so they can be successful in Salesforce Spiff, and enforce the principle of least privilege. Assign a default role to each user, or create custom roles with access to specific Spiff functionality.">user role</a> with this permission turned on.</p>
              <p style="margin-bottom:0;">Designer Configuration: Manage</p>
            </td>

          </tr>
        </tbody>
      </table>

For example, maybe you want to sum all opportunity products per account, which requires traversing an one-to-many relationship from account to opportunities and a one-to-many relationship from opportunity to opportunity products. We recommend that you start in the middle.

1. Create a one-to-many relationship, OpportunityToProducts, from opportunity to opportunity products.
    
    See [Set Up a Data Relationship in Salesforce Spiff](https://help.salesforce.com/s/articleView?id=sales.spiff_relationship_create.htm&release=264.0.0&type=5 "To set up a relationship between two object data tables in Salesforce Spiff, select a field with a common value for both objects.").
2. On the opportunity object, create a datasheet calculation that sums all related opportunity product amounts per opportunity.
    
    ```
    OpportunityProductTotal = sum(OpportunityToProducts, ProductPrice)
    ```
3. Create a one-to-many relationship, AccountToOpportunities, from account to opportunities.
4. On the account object, create a datasheet calculation that sums all related OpportunityProductTotal amounts.
    
    ```
    AccountTotal = sum(AccountToOpportunities, OpportunityProductTotal)
    ```

You can apply this same approach for any data type or field.