The Power Automate Sub function lets you subtract two numbers.
Its counterpart is the add function that lets you compute the sum of two numbers.
In this article, I’ll introduce you to the sub function and will provide a step-by-step guide on how to use the function in a Microsoft flow.
Power Automate Sub Function
Retrieve the outcome of subtracting the second number from the first number.
- minuend (mandatory): The number from which the subtrahend will be subtracted.
- subtrahend (mandatory): The number which will be subtracted from the minuend.
- Returns the difference between the first and second numbers.
Power Automate Sub Example
sub(3,1) => 2 // 3-1=2 // sample with use of a variable sub(variables('myNumber'),1)
How To Use The Power Automate Sub Function
Follow the steps to use the Power Automate sub function in a flow.
Create a new flow with trigger ‘Manually trigger a flow’
Add a new step by clicking on ‘+ New step’
Add a new step
Search for ‘initialize’ and click on ‘Initialize variable’
Add Initialize variable action
Setup Initialize variable: 1) Provide a name, 2) select type Integer, 3) Set value to 3
Add a compose by searching for ‘compose’ and clicking on ‘Compose’
Add Compose action
Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘sub(variables(‘myNumber’),1)’, 4) click on ‘OK’
Setup add expression in Power Automate
Do a test run
Result test run – Power Automate Sub function example