web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by 40

Hi,

I have this fetchxml:

  
    
    
      
    
    
      
        
        
          
        
      
    
  

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):

  • Contact 2
  • Contact 4

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.

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Jerome Vicente,

    I think this could not be achieved by a single fetchxml. In your case, you can only get the count of distinct contact in each Customer Journey record by this fetchxml:

      
        
        
          
        
        
          
            
    		
    		
              
            
          
        
      
    

    It's result would be like this:

    Snipaste_5F00_2022_2D00_03_2D00_11_5F00_13_2D00_26_2D00_30.png

    If you want to achieve your requirement, you could create a custom field in Customer Journey entity to populate it with the count of contacts by flow/plugin.(Rollup field can't work in this situation.)

  • Jerome Vicente Profile Picture
    40 on at

    Hi Steve,

    Thank you for the answer. I actually use the fetchxml above and I'm planning to use this on SSRS but I cannot be able to filter by campaign and then sum the column.

    Thanks,

    Jerome

  • Community Member Profile Picture
    on at

    Hi Jerome Vicente,

    What does "I cannot be able to filter by campaign and then sum the column" mean? Do you want to set the campaignid as dynamic value. For example: Do you want to get the count of contacts of current campaign record?

  • Jerome Vicente Profile Picture
    40 on at

    Hi Steve,

    I want to get all of the contacts of Campaign but there is a case that a contact can be on different Customer Journey just like on my question above. The goal is to filter by CAMP then get the sum of CCA_CON using SSRS.

    Thanks,

    Jerome

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Jerome Vicente,

    As I said above, you could not use fetchXML to achieve this. As a workaround, you could create a custom field in Customer Journey entity to populate it with the count of contacts by flow/plugin.(Rollup field can't work in this situation.)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 49 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans