
Currently I am sharing my knowledge with the Power Platform, with PowerApps and Power Automate. With over 8 years of experience, I have been learning SharePoint and SharePoint Online
In a recent YouTube video, Andrew Hess - MySPQuestions examines a common source of confusion in Microsoft Power Automate: the automatic insertion of Apply to Each (also shown as ForEach in the newer designer). He explains why these loops appear unexpectedly and shows practical ways to avoid or simplify them when they are not needed. Overall, his walkthrough focuses on understanding the shape of data and choosing the right expression or action to prevent unnecessary iterations. Consequently, the video aims to help makers reduce flow complexity and improve execution time.
Hess begins by clarifying that Power Automate inserts Apply to Each when an action outputs a collection, such as multiple rows from Excel or several items from SharePoint. He contrasts a single-value response with an array and an object, noting that the platform treats collections differently and therefore nests subsequent actions inside a loop. As a result, many users see loops even when they expect only one value, which leads to confusion and extra work. Therefore, recognizing whether the output is truly a multi-item array or a single object is the first practical step toward simplification.
The video highlights two primary strategies for "escaping" a loop: grabbing a single value directly, or flattening the array so the flow no longer treats the data as a collection. For a single value, Hess shows how functions like first() or index access such as [0] can extract the element without an explicit loop. In contrast, flattening involves transforming nested arrays into a single-level collection, using actions such as Select followed by Join, or by using expressions that combine elements into a string and then split them as needed. These approaches avoid redundant iterations but carry tradeoffs related to readability and error handling.
Hess demonstrates the practical steps to implement each technique, for example using a Compose action with the expression first(body('Get_Items')) to directly access a title from a SharePoint result that has only one item. He also shows how flattening with Select and Join can consolidate values when you truly need a single string rather than multiple records. However, he warns that using first() or direct indexing risks missing data when the collection unexpectedly contains zero items, and that flattening can obscure individual item errors, making debugging harder. Thus, the tradeoff becomes a balance between speed and resilience: fewer actions and faster runs often reduce transparency when things go wrong.
Beyond escaping loops, Hess touches on performance levers such as enabling concurrency in the loop settings and using pagination for large datasets. Concurrency can speed processing by running multiple iterations in parallel, but it can also introduce race conditions or exceed connector limits if upstream systems cannot handle parallel requests. Pagination helps retrieve many rows without forcing many small calls, yet it changes how you handle large results and may increase memory use. Consequently, makers must weigh speed gains against increased complexity in error handling and potential throttling from connectors.
Hess emphasizes that there is no single "right" method; rather, the best approach depends on the data and the desired outcome. He recommends inspecting action outputs in run history to confirm whether you have an array or object, using defensive expressions to handle empty results, and keeping flows readable by grouping related work into child flows when necessary. Moreover, he suggests that developers document why they chose first() or a flattening pattern to make future troubleshooting simpler and to guide colleagues who inherit the flow. In short, thoughtful tradeoffs and clear comments improve maintainability.
Andrew Hess’s video offers clear, approachable guidance for makers who want to avoid automatic loops in Power Automate without sacrificing correctness. By explaining the underlying data shapes and showing hands-on expressions and actions, he provides a toolkit that balances performance, clarity, and resilience. Ultimately, the choice between extracting a single value, flattening arrays, or using concurrency depends on the particular scenario, and the video helps viewers evaluate those tradeoffs. For teams aiming to streamline flows, the demonstrated methods are practical starting points that encourage careful testing and documentation.
escape Apply to each Power Automate, avoid ForEach Power Automate, bypass Apply to each performance, parallelize loops Power Automate, use Select instead of Apply to each, concurrency control Power Automate, optimize Power Automate loops, reduce iterations Power Automate