Power Automate Performance Trick: Replace Apply to Each with XPath

One of the most common Power Automate patterns is using Apply to Each simply to calculate totals, averages, or other summary values.

While it works, it often introduces unnecessary actions and makes your flows more complex than they need to be.

In this tutorial, I'll show you a simple performance technique using XPath that can replace many aggregation loops with a single expression. We'll build everything step by step, understand how XPath works, and apply the same pattern to both HTTP API responses and SharePoint Get Items.

In this video you'll learn:
✔️ Why Apply to Each isn't always necessary
✔️ Convert JSON arrays into XML for XPath
✔️ Calculate totals with sum()
✔️ Calculate averages
✔️ Filter data using XPath predicates
✔️ Build dynamic XPath expressions
✔️ Aggregate values by category
✔️ Use XPath with SharePoint Get Items


We'll work through practical examples using:
✔️ HTTP APIs
✔️ SharePoint Lists
✔️ Dynamic category summaries

Important: Whenever your data source can perform the aggregation, let the backend do the work. XPath shines when your flow already contains the data and you need fast, flexible summary calculations.

⏱️ Chapters
00:00 Introduction
00:39 Traditional Apply to Each Approach
03:44 How to Avoid Power Automate Loops using XPath
11:40 HTTP API Aggregation Example
15:53 SharePoint Get Items Example
19:30 Power Automate flow MCP Server to write XPath

#PowerAutomate #PowerPlatform #automation

➡️ The link to download flow is in Membership Tab of the channel for Channel Members (Gold 🥇 OR Silver 🥈)
To become a member, click here: https://www.youtube.com/rezadorrani/join


Power Automate Requests limits
https://learn.microsoft.com/power-platform/admin/api-request-limits-allocations

SharePoint aggregate queries (API)
https://www.youtube.com/watch?v=qsIn0mytC_8

Power Automate Flow Agent MCP Server
https://www.youtube.com/watch?v=25V_BBF4ymE Receive SMS online on sms24.me

TubeReader video aggregator is a website that collects and organizes online videos from the YouTube source. Video aggregation is done for different purposes, and TubeReader take different approaches to achieve their purpose.

Our try to collect videos of high quality or interest for visitors to view; the collection may be made by editors or may be based on community votes.

Another method is to base the collection on those videos most viewed, either at the aggregator site or at various popular video hosting sites.

TubeReader site exists to allow users to collect their own sets of videos, for personal use as well as for browsing and viewing by others; TubeReader can develop online communities around video sharing.

Our site allow users to create a personalized video playlist, for personal use as well as for browsing and viewing by others.

@YouTubeReaderBot allows you to subscribe to Youtube channels.

By using @YouTubeReaderBot Bot you agree with YouTube Terms of Service.

Use the @YouTubeReaderBot telegram bot to be the first to be notified when new videos are released on your favorite channels.

Look for new videos or channels and share them with your friends.

You can start using our bot from this video, subscribe now to Power Automate Performance Trick: Replace Apply to Each with XPath

What is YouTube?

YouTube is a free video sharing website that makes it easy to watch online videos. You can even create and upload your own videos to share with others. Originally created in 2005, YouTube is now one of the most popular sites on the Web, with visitors watching around 6 billion hours of video every month.