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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Group by count a value...
Power Automate
Suggested Answer

Group by count a value in array

(1) ShareShare
ReportReport
Posted on by 2
 
[
"Lord of the Rings",
"Star Wars",
"Harry Potter",
"Star Wars",
"Harry Potter"
]
This is my array output now I want to count by category 
Lord of the Rings : 1,
Start Wars: 2, 
Harry potter: 2 
Now from this i need to return maximum one's category and count  please give me solution it's urgent 
Categories:
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi,
     
    see whether this helps !
     
     
    Flow design 
     
    1. I have used initialize variable to initialize an array variable 
     
    2. Use the following json structure to enclose array variable in json format (for xml operations)
     
    3. use following select action which helps to get count of each element along with name as their property in json array
     
    Expression used - 
    union(variables('Arr1'),variables('Arr1'))
     
     
     
    Expression - 
    xpath(xml(outputs('Compose')),concat('count(//data[text()="',item(),'"])'))
     
    4. use select action to get count property
     
    5. use filter array to get the list of values which have highest count
     
     
     
    See the result of filter array action which gives the names and their count which have maximum occurences
     
    Hope it helps !
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

     
  • Suggested answer
    codeninja.sj Profile Picture
    115 on at
    Since you posted the question in the AI Builder Forum, I suggest to try custom prompt to group the records by count.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard