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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Why does SUM function ...
Power Automate
Unanswered

Why does SUM function work and MIN function not find a number???

(0) ShareShare
ReportReport
Posted on by 150

Hello:
I was successful in recreating the flow Paulie Murana (YouTube video -  MVP) published on

How to instantly sum an Array of numbers in a Power Automate Cloud Flow

 What I am looking to do is to find the MIN value from the column array returned. 

This flow runs successfully:
Get Items ✅>Select column values ✅> Compose JSON✅> Compose XML✅>Compose SUM of results

xpath(xml(outputs('Compose_JSON')),'sum(/root/Numbers)')

 
This results in error:
xpath(xml(outputs('Compose_JSON')),'min(/root/Numbers)')
❗Error Details:
Unable to process template language expressions in action 'Compose_min_function' inputs at line '0' and column '0': 'The XPath expression evaluates to a result of type 'Any' that is not supported. The expression must evaluate to a number, a string, a boolean, or a node set.'.
DublinOH_User_0-1717440093073.png

 

 

 

In the end what I am trying to accomplish is:

IF
the "when item is created" NetAmt is less than the lowest value in the GetItemsApprovers MinAmt

then send approval to created by manager
Else
If
"when item is created" NetAmt greater than GetItemsApprovers (MinAmt) and "when item is created" NetAmt less than GetItems (MaxAmt) 

get email addresses from Approver People column and send approval/s to those addresses.

Would be thankful to anyone that may be able to help.

DublinOH User



Categories:
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @DublinOH_User 

    The Power Automate only support the Xpath1.0. And the XPath 1.0 doesn't have the fancy min() and max() functions. So we can not use the max or min() function in your xpath.

    If you want to get the min of your array, you can directly use the min() function in your flow due to your Select action return an array of Number.

    min(body('Select'))
    vyueyunmsft_0-1717464562890.png

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at

    Get min value with xpath 1.0

    xpath(
    	xml('<Root><Item>111</Item><Item>21</Item><Item>99</Item><Item>200</Item></Root>'), 
    	'number(//Item[not(preceding-sibling::*<=number(.)) and not(following-sibling::*<number(.))])'
    )

     

    Chriddle_0-1717494372722.png

     

  • DublinOH_User Profile Picture
    150 on at

    @v-yueyun-msft 
    Thank you for the reply.  I did attempt several ways to get min fx to work in the way you suggested. Every time it fails stating the output of Select is not in the format needed for min to be analyzed.

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @DublinOH_User 

    Thanks for your response! If you want to use the Select action to get the min of the data, you need to check this:

    vyueyunmsft_0-1717551865789.png

    int(   item()?['FieldName']   )

     

    If this can not work in your side , you can show me the output of your Select action in your side!

     

    And also you can use the @Chriddle  posted xpath code to get the miniest data in your xml which is supported in Xpath1.0. 😀

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 424

#2
11manish Profile Picture

11manish 328 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard