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 / Update a sharepoint li...
Power Automate
Answered

Update a sharepoint list with count of duplicate items

(0) ShareShare
ReportReport
Posted on by

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. 

 

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    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.

     

  • Luckey Profile Picture
    on at

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

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    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
    on at

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

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard