Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Power Automate Desktop
Unanswered

XML xpath expression to get sum

Like (0) ShareShare
ReportReport
Posted on 6 Apr 2021 14:13:40 by 37

Hi Team,

 

I have been trying to execute an XPath expression in order to get the sum of a few nodes but it returns an "invalid XPath expression"

 

Below is the sample xml 

"<Xavor>

<Dev>
<NewNode1>1234</NewNode1>
<Emp>1</Emp>
<Floor>1</Floor>
<Salary>1200.4</Salary>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>123</Emp>
<Salary>3</Salary>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>3</Emp>
<Salary>1000</Salary>
<Floor>1</Floor>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>4</Emp>
<Salary>3</Salary>
</Dev>
</Xavor>"
 
Xpath query expression I have used:- SUM(Xavor/Dev/Salary)
 
Please help to correct any syntax I have missed.
 
Thanks 
Aditya
Categories:
  • fraenK Profile Picture
    2,125 on 07 Apr 2021 at 06:53:03
    Re: XML xpath expression to get sum

    Please post the full error message!

     

    It seems like PAD only supports retrieving nodes and its attribute values, not calculated values.

    So you need to get all desired node values first as a list and then process this list for calculation.

  • Aditya_93 Profile Picture
    37 on 07 Apr 2021 at 05:30:06
    Re: XML xpath expression to get sum

    I have tried the above path expression, but it's still giving me error as "invalid XPath expression"

    Can you please help me?

  • yoko2020 Profile Picture
    495 on 06 Apr 2021 at 17:29:55
    Re: XML xpath expression to get sum

    Try this

     

    sum(/*/Dev/Salary[string(number(.)) != 'NaN'])

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 64 Super User 2025 Season 1

#2
Nived_Nambiar Profile Picture

Nived_Nambiar 18 Super User 2025 Season 1

#3
CU12050101-0 Profile Picture

CU12050101-0 12

Overall leaderboard
Loading started