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 Solution
    • 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

Split items array in halves for faster processing in Power Automate

Posted on September 7, 2022September 30, 2023 by Tom

“I feel limited by the 50 parallel runs in Power Automate, can I somehow split the input array into halves to process it faster?”


If you feel that your Power Automate flow spends too much time in a loop, you can enable concurrency. With a simple configuration in the ‘Apply to each’ action you can switch from serial loop into parallel loop. Instead of one item at a time it’ll process up to 50 items at once. But what if you need more? How do you split the input between multiple such loops? E.g. split an array in halves to run 2 such loops in parallel?

How many is the half?

To split an array into halves you must first know what the half is. Use the length(…) expression on the array to get the full size, e.g. all the returned SharePoint items.

length(outputs('Get_items')?['body/value'])

Once you have the number you can split it by 2 to get the half.

div(length(outputs('Get_items')?['body/value']),2)

Get the first and second half

Now you know how many items should each of the arrays have and you can split it. Use the same combination of the skip(…) and take(…) expressions as when splitting email recipients to create the two arrays.

Update: you can use also the chunk(…) expression to split an array.

First array, take the first half:

take(<array>, <half the items>)

e.g.
take(outputs('Get_items')?['body/value'],div(length(outputs('Get_items')?['body/value']),2))

Second array, skip the first half and take the rest:

skip(<array>, <half the items>)

e.g.
skip(outputs('Get_items')?['body/value'],div(length(outputs('Get_items')?['body/value']),2))

The arrays can be then used in the two ‘Apply to each’ actions running in parallel.

Power Automate split array halves

Enable the concurrency control on both the loops and you can process up to 100 items at the same time.

Summary

If you have a slow loop in your Power Automate flow, you might consider to split the input array in halves to make it a bit faster. Get the whole size of the array, divide it by two, and use that number to take(…) and skip(…) the corresponding number of items. All the steps in this example were combined into two expressions, but you can do it step by step using multiple ‘Compose’ if you’d like.

Just keep in mind that parallel loops and branches can mess up your variables, unless you prepare them for it.


πŸš€ Master Power Automate

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

No spam. Unsubscribe anytime.

3 thoughts on “Split items array in halves for faster processing in Power Automate”

  1. Dan says:
    September 18, 2023 at 8:36 pm

    Is there a way to adjust this to divide by three? or even four? So 150 or even 200 items can be done simultaneously. Then how would we create the “apply to each” sections to reflect each section?

    Thank you!
    Dan

    Reply
    1. Tom says:
      October 22, 2023 at 3:27 pm

      Hello Dan,
      you can divide it by any number but I’d use the chunk(…) expression instead: https://tomriha.com/split-email-recipients-into-batches-of-500-with-power-automate-flow/, divide the whole length(…) by a number and split it into chunks. But the number of Apply to each branches in the flow will be fixed, you’ll have to manually add the corresponding number of parallel branches.

      Reply
  2. Drew says:
    August 22, 2024 at 6:22 pm

    Is there a way to get the length out of a Get attachment content? TIA

    Reply

Leave a Reply Cancel reply

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

πŸš€ Master Power Automate

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

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Get the Approval Process solution to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Are your approvals stuck due to unavailable approvers?

Keep your approvals running with the Approval task delegation app! Reassign any existing approval task to another user with a single click - no more waiting for absent approvers!

Power Automate approval task delegation ✨ 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