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 / Power Automate flow fo...
Power Automate
Answered

Power Automate flow for adding currency

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi ,

 

I have two entities where entities 1 having currency field, and entity 2 having total amount

so, when i have 5 records with different amounts in that and I need to get the total sum of all record currency in entity 2 field called total amount, please help me on this how i can get using flows.

 

entity 1

currency 100

currency 200

currency 300

currency 100

currency 20

 

entity 2

 

total amount 720

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Ashwinreddy 

     

    What's your database? Is it Dataverse?

  • Ashwinreddy Profile Picture
    Microsoft Employee on at

    Yes it is dataverse used to create entity .

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Are you able to show the JSON output from your Dataverse table (assuming you're using List rows action)? Specifically, the internal name of your Currency field.

  • Ashwinreddy Profile Picture
    Microsoft Employee on at

    Hi Grantjenkins,

     

    I have created list rows for the output and need to get total sum to another field in different entity,

    I am using the list rows to of both separately.

     

    Trying as below

    Ashwinreddy_0-1669003164398.png

     

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    As an example, I've created the below Dataverse Table with the default Name column and another column called Currency of type number (decimal). The internal name for my Currency column is cra85_currency.

    grantjenkins_0-1669006917780.png

    grantjenkins_1-1669006961912.png

     

    Below is my full flow that will get the sum of all the numbers. I'll go into each of the actions.

    grantjenkins_2-1669007068460.png

     

    List rows retrieves all the data in my Dataverse Table.

    grantjenkins_3-1669007104463.png

     

    We then use a Compose action (I've called it XML) to convert the JSON (body) from List rows to XML so we can use XPath to sum the numbers. This means we don't need to have a loop which makes it much more efficient/cleaner. The expression I use here is below. Effectively it's wrapping the output of List rows into a root element (required for valid XML), then converting to json then xml.

    xml(json(concat('{"root": ', outputs('List_rows')?['body'], '}')))

    grantjenkins_4-1669007283181.png

     

    Total is a Compose action that uses an XPath expression to sum all the numbers. The expression is below. Note that I've used my internal Currency name cra85_currency. You would need to put the internal name of your column here.

    xpath(outputs('XML'), 'sum(//value/cra85_currency/text())')

    grantjenkins_5-1669007377308.png

     

    And that's it. The output of Total is below:

    grantjenkins_6-1669007422550.png

     

    You can then add the total to your other Table.

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard