1 Reply Latest reply on Aug 22, 2018 12:05 PM by Okechukwu Ossai

    Calculated fields for related objects

    Adam Payne

      Hi everyone,


      I'm having trouble with creating calculated fields that need to look at related objects. In our SalesForce database we have Accounts with Contacts With Campaign Membership with campaigns, as shown in the screenshot. In this particular instance, I'm trying to find Accounts (labeled Household or Orgs) that have contact records that have campaign memberships to specific campaigns. Directly in SalesForce this would be very simple, Accounts with Contacts Report, cross-filter contacts with campaign history (there are other reasons I have to do this in Tableau).


      Though this is a specific example, in general I just need some help understanding how to query across several related objects. Any help or KB articles that I missed would be greatly appreciated!

        • 1. Re: Calculated fields for related objects
          Okechukwu Ossai

          Hi Adam,


          I believe the data join has already handled most of the logic in your proposed code. The best way to understand how to write this kind of formula will be to lay out your fields on the row shelf and just observe how they are related. Try this simplified version of your code and see how it goes.


          [GPG or Local Prayer Gathering]

          CONTAINS([Name (Campaign)], 'Gathering')

          Drag [Household or Org ID] and [Name (campaign)] to the Rows shelf. Add [GPG or Local Prayer Gathering] to the filter shelf and set to 'True'




          Alternatively, if you would rather have the formula return the accounts directly then do this;


          [GPG or Local Prayer Gathering]

          IF CONTAINS([Name (Campaign)], 'Gathering') THEN  [Household or Org ID] END

          Drag [GPG or Local Prayer Gathering] to the row shelf. Then add [GPG or Local Prayer Gathering] to the filter shelf and exclude null.



          Hope this helps.