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
Register for a Free Workshop.png

Register for a Free Workshop

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,626)