Time to complete: 30 minutes approx
Space-themed chatbot series:
Use Power Virtual Agents & Power Automate to calculate your weight on Mars
With Power Virtual Agents, you can streamline calculations. The idea of the calculator chatbot is that the bot will ask the user certain values. A standard formula will be created in Power Automate. It will take the user inputs for the calculation, and return the result back to the user.
The benefits of a calculator chatbot:
- Save time from doing manual calculations. You don’t need to remember the formula and can guarantee accuracy of the results
- Trigger workflows. Based on the result, you can initiate different workflows to occur.
- Data entry: Automatically store the results in a backend source/database. For example, if you need to calculate the floor area of a building, a flow can enter the result into it’s record.
In this example, you will create a Power Automate flow for your chatbot to calculate a person’s weight on Mars. Use the link below to download a PDF of the tutorial.
Space-themed bot series
This tutorial is part of a series of Power Virtual Agents tutorials on how to create a space-themed bot. Prerequisite: Make sure you have completed the prerequisite here before starting this tutorial, as it builds on the same bot.
About the flow: using Power Automate for calculations
In the activity above, you will create a flow to calculate the Martian weight based on the weight input the user provided in the conversation. Weight on Mars is calculated by the formula:
Weight on Mars = Weight on Earth ÷ 9.81 × 3.711
- Weight on earth is divided by 9.81m/s2, which is earth’s force of gravity. This part of the formula calculates the mass of the person.
- 3.711m/s2 is the gravitational force of Mars. This, multiplied by the person’s mass will give us their weight on Mars.
- The unit of weight does not matter. The user can provide weight in kilograms, pounds, or any other way.
To add calculations into your flow, you can use the Data Operation action- Compose, to write an expression for your formula. The Format Number action allows you round your values up to the nearest decimal.