Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Sub expression not working in Flow action

(0) ShareShare
ReportReport
Posted on by

Afternoon all

 

I've got a Flow where I'm trying to subtract the value from a field called 'Qty' in one list from a value in a field called 'Test qty' in a different as shown below:

 

QuantityINPUT.png

 

However expression isn't subtracting the values. This is the output from the tests I've run:

quantityOUTPUT.png

 

Where am I going wrong? All help appreciated!

  • AdminofMk Profile Picture
    62 on at
    Re: Sub expression not working in Flow action

    Hi @Expiscornovus ,

     Thanks for your effort to help me out, i found the solution. below expression works perfectly.

     

    AdminofMk_0-1670477037958.png

     

  • AdminofMk Profile Picture
    62 on at
    Re: Sub expression not working in Flow action

    Hi @Expiscornovus ,

     i double checked, the field was in number format only, 

    also i have tried the expression as your suggest, still same error occurs.

    AdminofMk_0-1670476091235.png

     

    AdminofMk_3-1670476622876.png

     

    AdminofMk_2-1670476603841.png

     

  • Expiscornovus Profile Picture
    31,641 Most Valuable Professional on at
    Re: Sub expression not working in Flow action

    Hi @AdminofMk,

     

    It looks like your Remaining Leave field is text. Try and convert it to a decimal or a number.

     

    Try something like:

    sub(float(outputs('Get_a_row')?['body/Remaining Leave']), triggerBody()['number'])
  • AdminofMk Profile Picture
    62 on at
    Re: Sub expression not working in Flow action

    HI @Expiscornovus ,

     I want to subtract a value from a excel table and subtract with the flow input then i need to update the excel table with the output from subtraction.  i tried a flow but its giving me some error can you help me out please.

     

    AdminofMk_0-1670437176192.png

    AdminofMk_0-1670437367241.png

     

  • Verified answer
    Expiscornovus Profile Picture
    31,641 Most Valuable Professional on at
    Re: Sub expression not working in Flow action

    Hi @Anonymous,

     

    Can you remove the single quotation mark characters around the Qty and Test qty variables in your expression?

     

    It will think you are trying to subtract strings instead of integer or float values. using the sub function for strings is not supported. This should work:

    sub(0,20)

     

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 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow