{"id":110919,"date":"2017-11-10T07:04:12","date_gmt":"2017-11-10T15:04:12","guid":{"rendered":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/power-automate\/calculate-running-totals-and-tracking-maximum-values-in-flow\/"},"modified":"2025-06-11T08:11:02","modified_gmt":"2025-06-11T15:11:02","slug":"calculate-running-totals-and-tracking-maximum-values-in-flow","status":"publish","type":"post","link":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/power-automate\/calculate-running-totals-and-tracking-maximum-values-in-flow\/","title":{"rendered":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow"},"content":{"rendered":"<p>A common question we get from Flow creators is how to calculate a running total or sum across a collection. Achieving this task in Flow might be straightforward to a programmer familar with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Imperative_programming#Rationale_and_foundations_of_imperative_programming\">imperative programming paradigms<\/a>, but it might not be as obvious to a non-developer. In this post, I&#8217;ll show how to:<\/p>\n<p>&#8211; Iterate over a collection of SharePoint items and track a running total of one of the list&#8217;s fields using the <strong>Initialize Variable<\/strong>\u00a0and <strong>Increment Variable<\/strong>\u00a0actions.\u00a0<\/p>\n<p>&#8211; Track the SharePoint list item that has the maximum value for one of the list&#8217;s fields using the\u00a0<strong style='font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>Initialize Variable<\/strong>\u00a0and\u00a0<strong>Set Variable<\/strong>\u00a0actions.<\/p>\n<p>&#8211; Store objects inside a variable and reference their properties in expressions.<\/p>\n<p>Here is the list that I have set up on SharePoint. My goals will be to calculate a sum of the\u00a0<code><tt>Capacity<\/tt><\/code>\u00a0field across all items, and track which city has the highest\u00a0<code>Capacity<\/code>.\u00a0<\/p>\n<p><img decoding=\"async\" alt=\"View of SharePoint list items\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.png\" style=\"width: 520px; height: 181px;\"\/><\/p>\n<p>To start, I will set up a <strong>When an item is created or modified<\/strong>\u00a0trigger so that my Flow runs when I edit or add a new item. I will also add a\u00a0<strong>Get items<\/strong>\u00a0action because my flow needs access to the full set of properties on each item.<\/p>\n<p><img decoding=\"async\" alt=\"SharePoint trigger and action\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/trigger.png\" style=\"width: 637px; height: 367px;\"\/><\/p>\n<p>\u00a0<\/p>\n<p>The basic algorithm for tracking the sum and maximum will be:<\/p>\n<ol>\n<li>Initialize an integer variable to 0.<\/li>\n<li>Initialize an object variable with some simple JSON to track the list item that has the highest Capacity<\/li>\n<li>Loop over each item\n<ul>\n<li>Increment the variable tracking the sum of capacities.<\/li>\n<li>Check the current item&#8217;s capacity value against the current highest-capacity item. If the current item&#8217;s value is greater than the stored item, replace the stored item<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Initializing the integer is easy, I only need to add an <strong>Initialize Variable<\/strong> action, select &#8220;Integer&#8221; from the type menu, and set the initial value to 0.<\/p>\n<p><img decoding=\"async\" alt=\"Initialize sum to 0\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/initsum.png\" style=\"width: 618px; height: 385px;\"\/><\/p>\n<p>Initializing the object is only slightly more complex. I added another\u00a0<strong>Initialize Variable<\/strong>\u00a0action. Object variables in Flow can be represented using <a href=\"http:\/\/www.json.org\/\">JSON<\/a>\u00a0(<strong>J<\/strong>ava<strong>S<\/strong>cript <strong>O<\/strong>bject <strong>N<\/strong>otation), a common format for representing objects and their properties.<b>\u00a0<\/b>The objects fetched from SharePoint\u00a0<strong>Get\u00a0items\u00a0<\/strong>are conveniently also represented as JSON, so we need to initialize our variable to something that &#8220;looks&#8221; similar. I will assign a default Title property and an initial Capacity of -1. (This simplifies the <strong>Apply to each<\/strong> action, as we will see shortly.) I could use two variables to track the maximum capacity and the title\/ID of the item with the maximum value, but where&#8217;s the fun in that?\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"smiley\" height=\"23\" src=\"https:\/\/blogs.azure.net\/Modules\/LuDC.CKEditor\/scripts\/ckeditor\/plugins\/smiley\/images\/regular_smile.png\" title=\"smiley\" width=\"23\"\/>\u00a0I&#8217;d also have to potentially re-query the item from SharePoint if I only stored the ID.<\/p>\n<p><img decoding=\"async\" alt=\"Init max using JSON\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/initmax.png\" style=\"width: 627px; height: 385px;\"\/><\/p>\n<p>Now for the iteration &#8212; I can select the value output of the <strong>Get items<\/strong> to process each list item in a loop. As I mentioned above, I first want to increment the SumOfAllCapacity integer variable. I can do that with an expression that references the current item&#8217;s <code>Capacity <\/code>property. (As the field type from SharePoint is actually decimal number, I need to convert it to a whole number using <code>int()<\/code>).\u00a0<\/p>\n<p><img decoding=\"async\" alt=\"Increment Variable\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/addtosum.png\" style=\"width: 1396px; height: 341px;\"\/><\/p>\n<p>Okay, the summation is handled, but now for tracking the maximum. I can add a\u00a0<strong>Condition<\/strong>\u00a0inside the\u00a0<strong>Apply to each<\/strong>\u00a0that will compare the current item&#8217;s capacity against the <code>Capacity <\/code>property of our object variable. If it is greater than the current stored value (the\u00a0<strong>If yes<\/strong>\u00a0fork of the<strong>\u00a0Condition<\/strong>), I will use\u00a0<strong>Set Variable<\/strong>\u00a0to overwrite the stored object with the current Sharepoint list item.\u00a0<strong>If no<\/strong>, I will leave the variable alone, as the current stored object has a <code>Capacity <\/code>greater than the current item. Remember how I initialized the <code>Capacity <\/code>property to -1 above? This allows the check against the stored value to succeed the first time through the loop (assuming our <code>Capacity <\/code>list field on SharePoint restricts to values &gt;= 0). If I didn&#8217;t initialize to a value, the Flow would have to be <a href=\"https:\/\/en.wikipedia.org\/wiki\/KISS_principle\">more complex<\/a> to handle the first item comparison.\u00a0<\/p>\n<p><img decoding=\"async\" alt=\"Compare item against stored variable\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/compare.png\" style=\"width: 1034px; height: 273px;\"\/><\/p>\n<p><img decoding=\"async\" alt=\"Set item to iterated value\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/setitem.png\" style=\"width: 655px; height: 346px;\"\/><\/p>\n<p>That&#8217;s it! I&#8217;ve added a simple\u00a0<strong>Send an email<\/strong>\u00a0action to send me the results. I&#8217;ve embedded the SumOfAllCapacity variable to show the total sum of all list items, and the item link, Title, and Capacity fields from the item stored in our object variable at the end of the iteration.\u00a0A more real-life example might use the results to send a nicer report,\u00a0<strong style='font-style: normal; font-size: 13.008px; font-family: Tahoma, \"Helvetica Neue\", Arial, Helvetica, sans-serif;'>Start an Approval<\/strong>\u00a0to authorize rebalancing capacity elsewhere, etc&#8230; The\u00a0<strong>Send an email<\/strong>\u00a0action goes\u00a0<em>outside<\/em>\u00a0of the loop, since we only want to execute it once the sum and maximum have been calculated. I&#8217;ve added some incredibly simple HTML tags to allow me to link to the SharePoint item directly. Here you can see how I reference the Capacity, Title, and {Link} properties of our MaxCapacity complex object with the following syntax in the Expression window: <code>variables('MaxCapacity')['Capacity']<\/code>.<\/p>\n<p><img decoding=\"async\" alt=\"send email card\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/sendemail.png\" style=\"width: 614px; height: 513px;\"\/><\/p>\n<p>Let&#8217;s take a look at the Flow Run history for this flow when it ran against my list. There were 3 items at the time of the change that triggered the flow: Seattle with\u00a015, Redmond with\u00a05, and Bellevue with 28. As expected, the\u00a0<strong>Apply to each<\/strong>\u00a0ran 3 times, and we can see the SumOfAllCapacity variable incrementing appropriately. Here&#8217;s iteration 3 where we add the 3rd item (Bellevue, 28) to achieve the correct answer of 48.<\/p>\n<p><img decoding=\"async\" alt=\"Iteration 3 of the loop\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/iter3.png\" style=\"width: 640px; height: 644px;\"\/><\/p>\n<p>The run history also shows us that on iteration 1 and 3 we take the\u00a0<strong>If yes<\/strong>\u00a0branch of the condition, but on the second we didn&#8217;t. That is because on the first pass we overwrite the -1 initial value with the Seattle record (<code>15 &gt; -1<\/code>), on the second pass Redmond&#8217;s capacity of 5 is less than 15, and on the third and final item, Bellevue&#8217;s 28 causes us to replace Seattle.<\/p>\n<p><img decoding=\"async\" alt=\"Iteration 2, condition not met\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/iter2.png\" style=\"width: 1308px; height: 434px;\"\/><\/p>\n<p>As expected, the email arrives with the expected results:<\/p>\n<p><img decoding=\"async\" alt=\"email results with correct answers\" src=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/email.png\" style=\"width: 287px; height: 203px;\"\/><\/p>\n<p>That&#8217;s it! As always, please let us know if you have any questions, suggestions, or feedback about Flow. Feel free to post below in the comments, on the <a href=\"https:\/\/powerusers.microsoft.com\/t5\/Microsoft-Flow-Community\/ct-p\/FlowCommunity\">Flow Community page<\/a>, or on Twitter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A common question we get from Flow creators is how to calculate a running total or sum across a collection. This post will walk Flow authors through tracking running totals across an Apply To Each loop as well as storing complex objects in variables and referencing their properties in expressions.<\/p>\n","protected":false},"author":358,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","ms-ems-related-posts":[],"footnotes":""},"audience":[3378],"content-type":[],"job-role":[],"product":[3474],"property":[],"topic":[],"coauthors":[2932],"class_list":["post-110919","post","type-post","status-publish","format-standard","hentry","audience-it-professional","product-power-automate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog\" \/>\n<meta property=\"og:description\" content=\"A common question we get from Flow creators is how to calculate a running total or sum across a collection. This post will walk Flow authors through tracking running totals across an Apply To Each loop as well as storing complex objects in variables and referencing their properties in expressions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/power-automate\/calculate-running-totals-and-tracking-maximum-values-in-flow\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Power Platform Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-10T15:04:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-11T15:11:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.png\" \/>\n<meta name=\"author\" content=\"David Blyth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Blyth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/\"},\"author\":[{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/author\\\/david-blyth\\\/\",\"@type\":\"Person\",\"@name\":\"David Blyth\"}],\"headline\":\"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow\",\"datePublished\":\"2017-11-10T15:04:12+00:00\",\"dateModified\":\"2025-06-11T15:11:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/\"},\"wordCount\":990,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/listview.png\",\"keywords\":[\"Developers\",\"Flow of the Week\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/\",\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/\",\"name\":\"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/listview.png\",\"datePublished\":\"2017-11-10T15:04:12+00:00\",\"dateModified\":\"2025-06-11T15:11:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/listview.webp\",\"contentUrl\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/listview.webp\",\"width\":520,\"height\":181},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/2017\\\/11\\\/10\\\/calculate-running-totals-and-tracking-maximum-values-in-flow\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/\",\"name\":\"Microsoft Power Platform Blog\",\"description\":\"Innovate with Business Apps\",\"publisher\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#organization\",\"name\":\"Microsoft Power Platform Blog\",\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Microsoft-Logo-e1685482038800.png\",\"contentUrl\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Microsoft-Logo-e1685482038800.png\",\"width\":194,\"height\":145,\"caption\":\"Microsoft Power Platform Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/#\\\/schema\\\/person\\\/077e85b5535603cf6aba435b316cb306\",\"name\":\"David Blyth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g2689207d5946fae4dce45a60db85b157\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g\",\"caption\":\"David Blyth\"},\"url\":\"https:\\\/\\\/cm-edgetun.pages.dev\\\/en-us\\\/power-platform\\\/blog\\\/author\\\/dblyth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/","og_locale":"en_US","og_type":"article","og_title":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog","og_description":"A common question we get from Flow creators is how to calculate a running total or sum across a collection. This post will walk Flow authors through tracking running totals across an Apply To Each loop as well as storing complex objects in variables and referencing their properties in expressions.","og_url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/power-automate\/calculate-running-totals-and-tracking-maximum-values-in-flow\/","og_site_name":"Microsoft Power Platform Blog","article_published_time":"2017-11-10T15:04:12+00:00","article_modified_time":"2025-06-11T15:11:02+00:00","og_image":[{"url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.png","type":"","width":"","height":""}],"author":"David Blyth","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Blyth","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#article","isPartOf":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/"},"author":[{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/author\/david-blyth\/","@type":"Person","@name":"David Blyth"}],"headline":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow","datePublished":"2017-11-10T15:04:12+00:00","dateModified":"2025-06-11T15:11:02+00:00","mainEntityOfPage":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/"},"wordCount":990,"commentCount":0,"publisher":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#organization"},"image":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#primaryimage"},"thumbnailUrl":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.png","keywords":["Developers","Flow of the Week"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/","url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/","name":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow - Microsoft Power Platform Blog","isPartOf":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#primaryimage"},"image":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#primaryimage"},"thumbnailUrl":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.png","datePublished":"2017-11-10T15:04:12+00:00","dateModified":"2025-06-11T15:11:02+00:00","breadcrumb":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#primaryimage","url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.webp","contentUrl":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/listview.webp","width":520,"height":181},{"@type":"BreadcrumbList","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/2017\/11\/10\/calculate-running-totals-and-tracking-maximum-values-in-flow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/"},{"@type":"ListItem","position":2,"name":"Advanced | Flow of The Week: Calculate running totals and tracking maximum values in Flow"}]},{"@type":"WebSite","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#website","url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/","name":"Microsoft Power Platform Blog","description":"Innovate with Business Apps","publisher":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#organization","name":"Microsoft Power Platform Blog","url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","contentUrl":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","width":194,"height":145,"caption":"Microsoft Power Platform Blog"},"image":{"@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/#\/schema\/person\/077e85b5535603cf6aba435b316cb306","name":"David Blyth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g2689207d5946fae4dce45a60db85b157","url":"https:\/\/secure.gravatar.com\/avatar\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fbacc81e66352b639fd1df0748c2f26d89039caca2b92566e51f51f493dbe14a?s=96&d=mm&r=g","caption":"David Blyth"},"url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/author\/dblyth\/"}]}},"bloginabox_animated_featured_image":null,"bloginabox_display_generated_audio":false,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Power Platform Blog","distributor_original_site_url":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/users\/358"}],"replies":[{"embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/comments?post=110919"}],"version-history":[{"count":1,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110919\/revisions"}],"predecessor-version":[{"id":131160,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/110919\/revisions\/131160"}],"wp:attachment":[{"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/media?parent=110919"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/audience?post=110919"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/content-type?post=110919"},{"taxonomy":"job-role","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/job-role?post=110919"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/product?post=110919"},{"taxonomy":"property","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/property?post=110919"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/topic?post=110919"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/cm-edgetun.pages.dev\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/coauthors?post=110919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}