Skip to main content

Notifications

Community site session details

Community site session details

Session Id : B8NmhzIVJIinpnLmJvkypD
Power Automate - Building Flows
Answered

Update a sharepoint list with count of duplicate items

Like (0) ShareShare
ReportReport
Posted on 19 Jan 2023 20:46:44 by 71

I had followed the solution here and found it to get me close to what I need, however, I'm wondering how to take my Sharepoint list of items and update the list to show how many times the item might be duplicated. 

 

For instance, I have a list of five things:

 

Ball
Dog
Cat
Dog
Armadillo

 

I'd like to be able to have another row that will show this


Ball | 1
Dog | 2
Cat | 1
Dog | 2
Armadillo | 1

 

By following the solution referenced above, I can email the table, but I would just like to have the list updated. 

 

  • Luckey Profile Picture
    71 on 20 Jan 2023 at 13:26:48
    Re: Update a sharepoint list with count of duplicate items

    Perfect! Works exactly as described. Thank you very much!

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 20 Jan 2023 at 07:47:22
    Re: Update a sharepoint list with count of duplicate items

    I've created a solution that will hopefully get what you're looking for. Note that this solution uses a reoccurring trigger that would run as often as you wanted (similar to the example you shared). This means when you add, delete, or modify an item the count wont update until the flow runs again so would be a delay. This also updates every item regardless of whether it needs to be updated or not.

     

    How many items do you have in your list?

     

    For this example, I'm using the following list. Title contains the names, and Count (Number data type) will contain the number of times the Title appears in the list.

    grantjenkins_0-1674190844362.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_7-1674198152257.png

     

    Reoccurrence is set to run on a schedule (up to you how often).

    grantjenkins_0-1674197148781.png

     

    Get items retrieves all the items from the list.

    grantjenkins_1-1674197188891.png

     

    Select creates a simple array of all the Titles in the list. Note that the Map is using Text mode (see arrow on screenshot).

    grantjenkins_2-1674197255618.png

     

    Apply to each uses the output from the Select but uses the union expression passing in the Select output twice so it removes any duplicates. So, the Apply to each will iterate over each of the unique Titles. The expression used is:

     

    union(body('Select'), body('Select'))

     

    grantjenkins_3-1674197361228.png

     

    Filter array will use the current Title and filter the items where the Title is equal to the current Title. The first time through the loop, the Title would be Ball, so the Filter array would filter the items in our list where the Title is equal to Ball. The second time through the loop, the Title would be Dog, so the Filter array would filter items in our list where the Title is equal to Dog, etc.

    grantjenkins_4-1674197437359.png

     

    Apply to each Update uses the output from the Filter array so it iterates through each of the items returned.

    grantjenkins_5-1674197561814.png

     

    Update item will update each of the items with the current number of instances for that Title. The expressions used are below:

     

    //Id
    items('Apply_to_each_Update')?['ID']
    
    //Title
    items('Apply_to_each')
    
    //Count
    length(body('Filter_array'))

     

    grantjenkins_6-1674198104762.png

     

    After the flow runs, we would see the following output.

    grantjenkins_8-1674198193275.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Luckey Profile Picture
    71 on 20 Jan 2023 at 03:16:10
    Re: Update a sharepoint list with count of duplicate items

    Thanks. I am actually looking for the counts added to each row. Based on the count number, I would have a flow that would send a notice to the "Dog" saying there are too many (if that makes sense)

    I had checked another link and this almost works except it doesn't at all (meaning it just doesn't result in accurate information)...

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 20 Jan 2023 at 00:38:54
    Re: Update a sharepoint list with count of duplicate items

    Would it work for you to just Group by that column in your list which would automatically show the count of each one.

     

    grantjenkins_2-1674175238514.png

     

    grantjenkins_0-1674175079866.png

     

    Or do you need the counts added to each row?


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, 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

Announcing the Engage with the Community forum!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Automate - Building Flows

#1
David_MA Profile Picture

David_MA 292 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 259 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 214

Overall leaderboard
Loading started