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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Subtract from SharePoi...
Power Automate
Unanswered

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
    Re: Subtract from SharePoint column unless greater than 0

     

    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
    Re: Subtract from SharePoint column unless greater than 0

    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

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard