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 / Subtract from SharePoi...
Power Automate
Answered

Subtract from SharePoint column unless greater than 0

(0) ShareShare
ReportReport
Posted on by 169

I am writing a flow that if someone changes a "status" column a second "priority" column will subtract 1 from the current value.  I am using the expression:

sub(outputs('Update_item_2')?['body/on0o'],1)

and it works, however I don't want to to go below zero.

I tried this, but it says my expression is invalid

if(triggerOutputs()?['body/on0o']>0,(sub(triggerOutputs()?['body/on0o'],1)),)

Any suggestions?

 

Categories:
I have the same question (0)
  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

     

    if
    (
     greater(variables('number'),0), sub(variables('number'),1), 0
    )

     

    See how you get on with that instead, I think your exact expression would be:

    if
    (
     greater(triggerOutputs()?['body/on0o'],0),(sub(triggerOutputs()?['body/on0o'],1)),0
    )

    But you will have to check your end.

     

    Please...

    If I answered your question Accept it as a solution ✔️ 

    If I helped you out, please give me some Kudos 👍

    Thanks 😙

  • sobenson Profile Picture
    169 on at

    Hi @Paulie78 , thank you! 

    You had one to many () in the sub statement in the example you copied of my info, (your example statement was correct) but this worked great!  Thanks!

     

    This was the final working version

    if(greater(triggerOutputs()?['body/on0o'],0),sub(triggerOutputs()?['body/on0o'],1),0)

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 67

#2
David_MA Profile Picture

David_MA 64 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 39 Most Valuable Professional

Last 30 days Overall leaderboard