cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Sum Field from an Array

Is it possible to sum an array (from a specific value)?  Right now I am using a get items action for SP, then I put the array returned into a variable that I then use a compse action to find the length (so I can count the items returned).  Is it possible to sum values from a field in that get items?

6 REPLIES 6

Re: Sum Field from an Array

I have tried creating a variable outside of a foreach, then adding the value from the array to that variable within the foreach and setting the variable.  It certainly increments in value but it is not sequential (i.e. the first 2-3 runs add correctly, but then it becomes sporadic and does not return the correct result).

 

Variable.PNG

Community Support Team
Community Support Team

Re: Sum Field from an Array

Hi @WiggityZwiggity,

 

Can you capture a screenshots of the detailed configuration about this flow? Including the trigger and the related fields.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: Sum Field from an Array

The trigger is a recurrence - I am getting items from a SP List.  I want to iterate through each item (using a for each) and sumthe values of the column "Unit_x0020_Cost".  I set a variable as a float (because this column contains non integer values) and then add the column "Unit_x0020_Cost" to that variable within a foreach from the get item array.  I then set the variable to the output of that function.  I get odd returns (for the record each of the values in this column have been filtered to a single value to make verifying the math easier - each item has a value of 3.5)

 

First return is 3.5

Second return is 7 (which is correct)

Third return is 10.5 (also correct)

Fourth return goes back to 3.5 (not correct)

 

Then it's all over the place from there.

 

Picture: Full Variable.PNG

Re: Sum Field from an Array

It seems like is handling these actions in parallel vs sequentially within the for each loop.

Re: Sum Field from an Array

Is there a pause feature that would allow for the system to appropriately iterate on that variable?

Re: Sum Field from an Array

Any other advice you can help with on this?

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,598)