cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kmayes
Post Prodigy
Post Prodigy

Sum an array column

Hi

 

I have an array that I have created within my flow, I'm trying to find a solution to sum the values in the first column (as per image) to provide a total value. Is this possible? 

 

Kmayes_0-1610709753751.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Kmayes 

You can go through all the records, get the first column, and add it to an existing variable, like I did in the following example:

float.png

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

11 REPLIES 11
Rahber
Super User
Super User

Hi,

 

Can you please elaborate more?

 

You created an array in the text i.e. its a table? or have you created an array as a variable within the flow?

 

Please click Accept as Solution if it resolved your problem or give it a Thumbs Up if it helped you in anyway this will allow other people to search correct solutions effectively.

Thanks,
Rahber

Kmayes
Post Prodigy
Post Prodigy

@Rahber 

Hi 

 

I have a array variable that then gets passed into a HTML table to generate the output that is then placed on an e-mail as per the image. Let me know if you need more detail 

 

Hello @Kmayes 

You can go through all the records, get the first column, and add it to an existing variable, like I did in the following example:

float.png

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

Hi @fchopo 

 

Thank for your reply. I seem to have hit an error not sure why any ideas?

Kmayes_0-1610960157644.pngKmayes_1-1610960262417.png

 

Paulie78
Super User
Super User

The final value of that column your array could not be converted to a float. Paste the contents of your array and we can have a look.

@Paulie78 

Kmayes_0-1611002685662.png

 

Hello @Kmayes 

In which column are you applying the "increment variable" action? You erased the column name, so we don't know over which column you're trying to apply the conversion.

Regards,

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

@fchopo Sorry, "Totex Inc D&PG"

fchopo
Super User
Super User

Hi @Kmayes 

I think you're trying to convert a string to a float number, and it's throwing an error because there is some invalid characters. What is the type of "Totex Inc D&PG" column in SharePoint? String? Number?

 

In fact, I read you applied a formatNumber function, so that's probably the problem.

Could you apply the following expression?:

float(replace(items('apply_to_each_6')?['TotexIncD&PG'],',','.'))

It replaces "," for "." so it can convert this value to a float.

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Hi @fchopo 

Yes the column output from the formatted number is type String. As per my first image in this thread the values are a cost value so could be £100.00 £0.00 and so on.

 

I have just tried your expression but I receive this message 

 

Kmayes_0-1611071189170.png

 

Ive managed a work around whereby creating its own array before the number was formatted, then formatted the output value of the floated value and this has worked as required. 

Thanks for all you help and guidance its much appreciated.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,275)