Hi @jms0529 ,
To perform and display calculations in a PowerApps canvas app, you can use labels to show the result. Here's a simple guide:
Add Text Inputs: Place two Text Input controls on the canvas for users to enter numbers (TextInput1 and TextInput2).
Perform Calculation: Write a formula to perform the calculation based on the values entered in the text inputs. Use the Value() function to convert text to number.
Display Results: Use a Label control to display the result. Set its Text property to the calculation formula.
Here's a step-by-step example:
Add two Text Input controls (TextInput1 and TextInput2).
Add a Label to the canvas to display the result.
Set the Text property of the result Label to the following formula:
Text(1 - (Value(TextInput1.Text) / Value(TextInput2.Text)), "0.0%")
The Value() function converts text to a number, and the Text() function formats the number as a percentage with one decimal place.
Make sure that the input fields are set to accept only numerical input to prevent errors in the calculation.
If you want to store the result in a variable and use it elsewhere in your app, you can use the Set() function on some event (like OnChange of the text inputs) to perform the calculation and store the result. For example:
// OnChange property of TextInput1 or TextInput2
Set(
ResultVariable,
1 - (Value(TextInput1.Text) / Value(TextInput2.Text))
);​
hen set the Text property of the Label to:
Text(ResultVariable, "0.0%")
By following these steps, you will be able to perform the calculation and display the result on the same screen in your PowerApps canvas app.
Best Regards,
Hassan Raza