Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Why is your Power Automate flow creating duplicates

Posted on June 26, 2022June 26, 2022 by Tom

“I have a Power Automate flow that mostly works but sometimes it’s creating duplicates of the items/documents and I don’t know why.”


Some problems in a flow are easy to notice, others not so much. The worst ones are problems that happen only from time to time. The flow can run for days, weeks, even months, and then it fails. Nobody touched it, but this time the flow created duplicate entries. Why now? What changed from the previous runs?

Duplicates = mostly unnecessary loops

There can be two reasons why your flow would create duplicates. Either did the flow run multiple times or it contains a loop that shouldn’t be there. If it’s running multiple times you might be dealing with the infinite trigger loop or you might need to add a trigger condition. But if it’s inside a single flow run, it’ll be most probably due to some ‘Apply to each’ loop.

Every ‘Apply to each’ loop in the flow means that everything that’s inside the loop can run multiple times. You’ve got an array as the input of the ‘Apply to each’ and the flow will repeat all the actions inside for each of the items. For example, if I have a flow as below it’ll repeat the ‘Create file’ for each item returned by the ‘Get items’ action.

If the ‘Get items’ returns 1 item, it’ll create 1 file. If it returns 5 items it’ll create 5 files and so on. Which is fine and often the goal of the flow. When the problems start is if you’ve got another ‘Apply to each’ inside the ‘Apply to each’.

Power Automate creating duplicates

This second ‘Apply to each’ is often added automatically once you try to use some dynamic content. And the reason is that the dynamic content comes from an array. For example if you’re using SharePoint multiple selection fields (choice/lookup/people picker). The flow knows from the list structure that these are multiple selection columns and as such it wants to process all the possible entries.

Remove the inside loop

If there’s only one value, it’ll repeat the action only once. But once you get in a situation when there’re multiple values it’ll repeat the action for each of them. Following the example above, if there’s only 1 value selected, it’ll create 1 file. If there’re 5 values selected it’ll create 5 files. And it’ll repeat it over and over again for each item in the first loop.

If you want to create just 1 file with all the information, you must remove the inner ‘Apply to each’. That often means to input all the selections at once as an entire array. Once you remove it you’ll remove also the potential for creation of duplicates.

Summary

You should always be careful when Power Automate starts adding ‘Apply to each’ inside another ‘Apply to each’ as that’s the most common situation for creating duplicates. It’ll work fine if the inner loop runs only once, e.g. if there’s only 1 person/choice/lookup in a multiple selection SharePoint column. But once there’re more than 1 it’ll start creating duplicates. Therefore, if your flow starts producing duplicates, the first thing to look for are loops.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

7 thoughts on “Why is your Power Automate flow creating duplicates”

  1. Moises says:
    January 30, 2023 at 4:59 pm

    I am groing crazy with copying items. It always creates 2 or more copies and I only have one apply to each. Im using a condition if a column is equally to x then copy the item. But I don’t know where I am failing. :/

    Reply
    1. Tom says:
      February 9, 2023 at 9:36 pm

      Hello Moises,
      my first guess is that you’ve got ‘Apply to each’ inside another ‘Apply to each’ as that’s a common problem, try to remove as many loops as possible from the flow: https://tomriha.com/stop-power-automate-flow-from-adding-apply-to-each-automatically/

      Reply
    2. Scott Howard says:
      February 10, 2023 at 2:49 pm

      Mine has the exact same issue. I also don’t have multiple Apply to Each but I still get duplicates. That Tom dude straight-up ignored your entire sentence which is unhelpful.

      Reply
      1. Tom says:
        February 22, 2023 at 7:19 pm

        Hello Scott,
        if it’s creating duplicates you are probably looping through too many items. Check the flow run history to see how many times did the loop run. If it’s more than you expected than something is wrong, which you can try to debug by adding a ‘Compose’ action inside the loop and store some identifier of the currently processed value, e.g. name/title/whatever will help you identify why the flow is running that way.

        Reply
  2. Alisha says:
    November 12, 2024 at 9:10 pm

    Thank you!!! I spent hours trying to figure out what was wrong with my flow, but spending less than 5 minutes reading this article just now solved my problem!

    Reply
  3. June Mountjoy says:
    March 12, 2025 at 3:30 pm

    My flow is creating two item and I have no ‘Apply to Each’. Fill form then create item. If I check the Form’s xlsx, there’s only one record.

    Reply
    1. Tom says:
      April 5, 2025 at 8:45 am

      Hello June,
      if there’s no loop in the flow I’d check if there isn’t maybe a different flow that’s doing the same task.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes