web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need to parse CSV stri...
Power Automate
Suggested Answer

Need to parse CSV string value into a JSON as a number

(0) ShareShare
ReportReport
Posted on by
I am building a gift report that needs to sum the giving amount values of distinct donors by their giving amount. However when I parse the CSV file into JSON, it only sees all incoming values as a string regardless of the format of the number.
 
I'm unable to sum the JSON values using XML as it does not see it as a number. The data contains thousands of records, so trying to keep the run time low is a priority. Here is a fake sample of what I'm trying to do conceptually.
 
Full Name Email Phone Gift Amount
 Barry Allen flash@email.com 3055551212 $121
 Clark Kent superman@email.com 7565556789 $1
 Bruce Wayne batman@email.com 8095559876 $1,000,000
 Diana Troy wonderwoman@email.com 6665551212 $2,500
 Barry Allen flash@email.com 3055551212 $55
 Bruce Wayne batman@email.com 8095559876 $6,000,000
 Bruce Wayne batman@email.com 8095559876 $500,000
Categories:
I have the same question (0)
  • Suggested answer
    rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at
    Hi,
     
    If I understood correctly, you were able to convert you CSV data into a JSON array, and now need to sum the Gift Amount property from all objects. If my understanding is wrong, please provide some additional context and maybe some images of your current flow design. 
     
    For this answer, I'm using the following data, which is also organized in an JSON array of objects, where the amounts are represented in strings:
     
    The first step is to create a new variable of float type to store your final sum. Make sure to set its value as zero:
     
     
    Now you can loop your JSON array (in my case, the "json" variable) and add a Increment variable action within the loop, referencing your float var: 
     
    Inside the Increment variable action value, add the following expression: float(item()['Gift Amount']). In this step, we are accessing the Gift Amount property from each of the array elements, converting it into float data type and then adding it to the total amount variable. Since float is a numerical data type, no errors must be raised.
     
    I also included a final Compose, just to print the result of total amount variable after the loop. The result is a sum of all gift amounts, as expected:
     
    I'm also sharing some articles related to the topics discussed here, which can be useful for you or for other users that find this thread in the future:
     
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
     
  • lbendlin Profile Picture
    8,479 Super User 2025 Season 2 on at
    Load the data into a database, run a database query.

    Power Automate is not something you want to use for "thousands of records".

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard