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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Producing a table of u...
Power Automate
Answered

Producing a table of unique items from a Sharepoint list

(1) ShareShare
ReportReport
Posted on by 11,128 Moderator

Trying to set up a flow that produces a table of unique items in a sharepoint list and counts their total occurances.

 

For example

 

Red

Red

Blue

Red

Blue

Orange 

 

Would return 

Red 3

Blue 2

Orange 1

 

I was following this guide in a blog post

 

Group Sharepoint List by Items 

 

But in Step 3 the poster left out a step

 

////

Select an output from previous steps: Outputs is the value from "Compose union of departments" action created in Step 3.

 

Filter array: 

a. value is the value from Get Items action created in Step 1.

b. Comparing "Department Visiting" is equal to Output of "Current Department Name" action.

////

 

Between those two there should be something telling you how to reference the 'DeptName' you created in an earlier step. 

 

This is not a default option so I am guessing its an expression but cannot figure it out.

 

Any help would be appreciated

 

@rsaikrishna was the original user to create the blog (thanks by the way its an excellent one) but he hasnt yet posted a response to the other people who asked this there so I thought I'd seek help in the forums 

Categories:
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @TheRobRush 

     

    Copy and Paste (via Ctrl+V) the following to New Step -> My Clipboard to get an instant solution demo:

     

    {"id":"dc6bc136-161e-484d-bb4b-e786-ad7faa1d","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365_Sum_Of_Array_Elements","operationDefinition":{"type":"Scope","actions":{"OriginalArray":{"type":"Compose","inputs":["Red","Red","Blue","Red","Blue","Orange"],"runAfter":{}},"Union":{"type":"Compose","inputs":"@union(outputs('OriginalArray'),outputs('OriginalArray'))","runAfter":{"OriginalArray":["Succeeded"]}},"Apply_to_each":{"type":"Foreach","foreach":"@outputs('Union')","actions":{"Filter_array":{"type":"Query","inputs":{"from":"@outputs('OriginalArray')","where":"@equals(item(), items('Apply_to_each'))"},"runAfter":{}},"Length":{"type":"Compose","inputs":"@{items('Apply_to_each')} @{Length(body('Filter_array'))}","runAfter":{"Filter_array":["Succeeded"]}}},"runAfter":{"Union":["Succeeded"]}},"Result_ArrayOfLengths":{"type":"Compose","inputs":"@Outputs('Length')","runAfter":{"Apply_to_each":["Succeeded"]}}},"runAfter":{}}}

     

    This is what the solution looks like:

    DamoBird365_0-1619290842680.png

     

    Here is the Apply to Each expanded

     

    DamoBird365_1-1619290876070.png

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • Verified answer
    Paulie78 Profile Picture
    8,424 Moderator on at

    Funnily enough I just did a video that covers this for someone that asked me a question on YouTube / it’s almost exactly what you are asking for:

    https://youtu.be/LjDSnt8IBTA

    ignore the title, it does what you want.

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Great video, walking through it like this helped me figure out what it was that had been missing. Thank you!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard