Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Group by in Power Automate - Data Step: List Records - FetchXML

(0) ShareShare
ReportReport
Posted on by 8

Hi Community,

 

Please your kind help, I'm using: 'Data Step: List Records', in which need to do a 'Group By', so decided using “FetchXML” section, to group by the Contacts per status, but get error.

 

The xml only allows to 'group by' contact id, and is the following:

<fetch aggregate="true" >
<entity name="contact">
<attribute name="contactid" alias="contactid" groupby="true" />
<attribute name="statecode" alias="statecode" aggregate="count" />
</entity>
</fetch>

The result:
——Contact Id——State Code
AAedcf55-df22-eb11-a813-000d3a361686 —- 1
bbbbbbbb-df22-eb11-a813-000d3a361686 —- 1

 

 

Grouping by ‘state code’ there is an error.

<fetch aggregate="true" >
<entity name="contact">
<attribute name="contactid" alias="contactid" aggregate="count" />
<attribute name="statecode" alias="statecode" groupby="true" />
</entity>
</fetch>


How can I group by in fetch xml for Power Automate Flow? to get this:
——Amount of Records——State Code
——3——————-1
——4——————-0

 

Contact Selection.PNG

 

Thanks and best regards.

  • Verified answer
    ChrisPiasecki Profile Picture
    6,397 Most Valuable Professional on at
    Re: Group by in Power Automate - Data Step: List Records - FetchXML

    Hi @roxana_cq,

    FetchXml aggregation is not currently supported in the List Records action in Power Automate.

     

    You can use the HTTP with Azure AD connector to send a request to the Dataverse Web API, passing the encoded FetchXml in the query string parameter.

    Refer to this article for a good example of this:

    https://tldr-dynamics.com/blog/fetchaggr-auto-reporting

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1