Fetchxml: Get sum of all distinct field values with different records

Forum Post: Change the Filter On option on Opportunity Associated View for Account form


I have this fetchxml:

<fetch distinct="true" aggregate="true">
  <entity name="campaign">
    <attribute name="campaignid" alias="CAMP" groupby="true" />
    <filter type="and">
      <condition attribute="campaignid" operator="eq" value="34327c5e-7a52-ec11-8f8e-00224816059b" />
    <link-entity name="msdyncrm_customerjourney" from="new_campaignid" to="campaignid" link-type="outer">
      <link-entity name="msdyncrm_customerjourneycustomchannelactivity" from="msdyncrm_customerjourney" to="msdyncrm_customerjourneyid" link-type="outer">
        <attribute name="msdyncrm_contact" alias="CCA_CON" aggregate="countcolumn" distinct="true" />
          <condition attribute="msdyncrm_contact" operator="not-null" />

I have this scenario:

Customer Journey Custom Channel 1 (3 records with Contacts):

  • Contact 1
  • Contact 2
  • Contact 3

Customer Journey Custom Channel 2 (2 records with Contacts):

When I run the fetchxml, it will display 4 since Contact 2 is on both Customer Journey Custom Channel. I want to display 5 instead.

Thank you in advance.

Source link

Leave a reply

Please enter your comment!
Please enter your name here