cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohanHaas
New Member

Subtotal of negative and positive value

Good day Power community!

 

I am having some trouble with the final part of my flow, my use case is:

 

I have created a basic approval process to request/approve changes in our Production schedule.

 

I have a power app where users can fill out a form and request a change in quantity to a specific month and product's "Scheduled production amount". This then triggers an approval process to a manager, if the request is approved the "change in quantity" should then be added to the relevant place in the main Production schedule.

 

This seems easy enough, and I have got it working perfectly when the change in quantity value is positive, by using the "Update Item" action in flow and then using the add() function to add the request quantity to the original amount.

 

The problem comes in when you want to request to decrease the production quantity for a certain month. Apparently, the add() function does not like the negative value "-5", any ideas how I can work around this?

 

Maybe there is something I can do with variables? Most of my inputs come straight from powerapps.

 

So yeah to summarize the major issue is that the add() function works for positive values 5+10=15, but not for negative changes -5+10=Error

 

Any help would be greatly appreciated!

 

More details below:

 

2233114.jpg

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RobElliott
Super User
Super User

The add() expression doesn't normally have any issues with negative numbers. Try putting the numbers into 2 compose actions and adding up them up in an add expression in a third compose:

 

add2Compose.png

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

2 REPLIES 2
RobElliott
Super User
Super User

The add() expression doesn't normally have any issues with negative numbers. Try putting the numbers into 2 compose actions and adding up them up in an add expression in a third compose:

 

add2Compose.png

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Rob you genius!

 

Thanks so much, working perfectly now.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,927)