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 / Summarize all values f...
Power Automate
Unanswered

Summarize all values from JSON together

(0) ShareShare
ReportReport
Posted on by 132

Hi how can i summarize all JSON values togetehr? 

Zohaib1999_0-1713867327640.png

BODY: 

{ "Pallets":

 

{ "Gross_Weight": "575 kg",

  "Net_Weight": "" },

{ "Gross_Weight": "720 kg",

"Net_Weight": "" },

{ "Gross_Weight": "50 kg",

"Net_Weight": "" }}

 

 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Zohaib1999 

     

    Pls let me know the excepted result from the output of compose action.

     

     

     

  • Zohaib1999 Profile Picture
    132 on at

    I want to sum all values together in one compose "TotalGrossWeight" and  a another one "TotalNetWeight". Since there could be more then one i need prob a 'for each' condition. But i failing doing that so i asked here for support. 

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Zohaib1999 

     

    You can use xml & xpath functions to get the sum. Here is a sample flow.

     

    I have stored input array in a compose action:

    ManishSolanki_0-1713872083803.png

    { 
    "Pallets":[
    {
    "Gross_Weight": "575 kg",
    "Net_Weight": ""
    },
    {
    "Gross_Weight": "720 kg",
    "Net_Weight": ""
    },
    {
    "Gross_Weight": "50 kg",
    "Net_Weight": ""
    }
    ]
    }

     Add another compose action. We will be using expression to get the sum of all nodes using xml & xpath. Expression needs to be added in the expression box as shown below:

    ManishSolanki_1-1713872325050.png

    concat(xpath(xml(json(replace(concat('{"root":',outputs('Compose'),'}'),' kg',''))),'sum(//Gross_Weight)'),' kg')

     

    Output:

    ManishSolanki_2-1713872500983.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard