In this Power Automate Desktop tutorial, we will see how to perform Mathematical calculations using mathematical operators using Power Automate Desktop.
So here we will discuss the below Mathematical operator:
- Addition
- Subtraction
- Multiplication
- Division
- AND
- OR
- NOT
Let’s see how we can perform a mathematical operation in Power Automate Desktop.
Mathematical Operation in Power Automate Desktop
Here we will see how to do Mathematical operations in Power Automate Desktop.
We will take two variables i.e. num1 and num2, which contain 10 and 20, respectively. Then we will perform the mathematical operations using these two numbers.
Step-1: Open Power Automate Desktop, provide the flow name, then click on Create.
Step 2: We will add 2 variables to the flow i.e. num1 and num2. Expand the variable section and then drag and drop the Set variable action. Then provide the below information:
- Change the variable name to Num1.
- Value: Provide the value as 10.
Similarly, following the above steps, add the variable num2 to the flow.
Operation 1: Addition
Step 3: Expand the Message box section to do an addition operation between 2 numbers. Then drag and drop the Display message action to the flow. Then provide the below information.
- Message box title: Provide the title of the message box.
- Message to display: Provide the below code:
%Num1 + Num2%
- Then change the variable name to ‘Addition’.
Step 4: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation 2: Subtraction
Step 5: Expand the Message box section to do a subtraction operation between 2 numbers. Then drag and drop the Display message action to the flow. Then provide the below information.
- Message box title: Provide the title of the message box.
- Message to display: Provide the below code:
%Num2-Num1%
- Then change the variable name to ‘Subtraction’.
Step 6: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation 3: Multiplication
Step 7: Expand the Message box section to do a multiplication operation between 2 numbers. Then drag and drop the Display message action to the flow. Then provide the below information.
- Message box title: Provide the title of the message box.
- Message to display: Provide the below code:
%Num1 * Num2%
- Then change the variable name to ‘Multiplication’.
Step 8: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation 4: Division
Step 9: Expand the Message box section to do a division operation between 2 numbers. Then drag and drop the Display message action to the flow. Then provide the below information.
- Message box title: Provide the title of the message box.
- Message to display: Provide the below code:
%Num1 / Num2%
- Then change the variable name to ‘Division’.
Step 10: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation 5: AND
Step 11: To do the AND operation between 2 numbers, we will check if (Num1=10 AND Num2=20)=True, the condition is true, then it will display the message ‘ Both the condition are true’, else Both the condition are false.
For this, expand the conditions section, drag and drop the IF action, then provide the below information:
- First Operand: provide the first operand as below code:
%Num1 = 10 AND Num2 = 20%
- Operator: Select the operator as equal to
- Second Operand:: Provide the second operand as True.
Step 12: Then drag and drop the Display message action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result
Step 13: Now we will add the else part, so from the condition section drag and drop the Else action.
Step 14: Then drag and drop the Display message action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result.
Step 15: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation 6: OR
Step 16: To do the OR operation between 2 numbers, we will check if (Num1=4 OR Num2=20)=True, the condition is true then it will display the message ‘ One of the conditions is true’, else if (Num1=10 OR Num2=20)=True, the condition is true then it will display the message ‘ Both the condition is true’, else Both the condition are false.
For this, expand the conditions section, drag and drop the IF action, then provide the below information:
- First Operand: provide the first operand as below code:
%Num1 = 4 OR Num2 = 20%
- Operator: Select the operator as equal to
- Second Operand:: Provide the second operand as True.
Step 17: Then drag and drop the Display message action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result
Step 18: Now drag and drop the ‘Else if’ action to the flow page. Then provide the below information:
- First Operand: provide the first operand as below code:
%Num1 = 10 OR Num2 = 20%
- Operator: Select the operator as equal to
- Second Operand:: Provide the second operand as True.
Step 12: Then drag and drop the Display message action in between Else if action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result
Step 20: Now we will add the else part, so from the condition section drag and drop the Else action.
Step 21: Then drag and drop the Display message action in between the else action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result
Step 22: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Operation: Not
Step 23: To do the Not operation on Num 1, if (Num1 !=11) =True, then it will return true, else false.
For this, expand the conditions section, drag and drop the IF action, then provide the below information:
- First Operand: provide the first operand as below code:
%Num1 != 10%
- Operator: Select the operator as equal to
- Second Operand:: Provide the second operand as True.
Step 24: Then drag and drop the Display message action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result
Step 25: Now we will add the else part, so from the condition section drag and drop the Else action.
Step 26: Then drag and drop the Display message action to show the result. Then provide the below information:
- Message box title: Provide the message box title.
- Message to display: Provide the message to display.
- Then change the variable name as a result.
Step 27: Now run the flow by clicking on the Run button. Then message box will pop up with a result.
Conclusion
In this Power Automate Desktop, we saw how to perform different types of mathematical operations in Power Automate Desktop.
You may like the following tutorials:
- Extract substring from text using Power Automate Desktop
- Power Automate Desktop format date
- Power Automate Desktop loop through Excel rows
- Power Automate desktop concatenate strings
- Create File in SharePoint using Power Automate Desktop
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com