Skip to main content

Notifications

Community site session details

Community site session details

Session Id : KqFGEJi31+xKNWaFGJeMyK
Power Apps - Building Power Apps
Unanswered

How to perform and display calculation

Like (1) ShareShare
ReportReport
Posted on 9 Nov 2023 19:50:58 by 36

I have a canvas powerapp with text input fields. I want to perform calculations such as multiplication and division then display the result on the same screen. How can I achieve this?

 

Example:

  • Text Input 1 (user enters 😎
  • Text Input 2 (user enters 906)
  • Calculation performed (1-(Text Input 1/Text Input2)) = 99.1%
  • Results (99.1%) displayed in a 3rd field (Not sure what field type is required?)
  • CU10021449-0 Profile Picture
    6 on 15 Feb 2025 at 10:30:40
    How to perform and display calculation
    In your Canvas PowerApp, you can use a Label to display the calculated result. First, add two Text Input fields (e.g., txtInput1 and txtInput2). Then, add a Label and set its Text property to:
    Text(1 - (Value(txtInput1.Text) / Value(txtInput2.Text)), "0.0%")
    This formula converts the text inputs to numbers, performs the calculation, and formats the result as a percentage. The label will automatically update when the user enters new values.
     
  • Ninja_365 Profile Picture
    99 on 12 Nov 2023 at 07:47:42
    Re: How to perform and display calculation

    Hi @jms0529 ,

    you can try this 

    Text(1 - (Value(TextInput1.Text) / Value(TextInput2.Text)), "0.0%")

    I hope this helps you set up your calculation in the app! If you find this solution helpful, feel free to accept it. 😊

  • Hassan_SZ_365 Profile Picture
    542 on 09 Nov 2023 at 20:16:14
    Re: How to perform and display calculation

    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:

    1. Add Text Inputs: Place two Text Input controls on the canvas for users to enter numbers (TextInput1 and TextInput2).

    2. 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.

    3. 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:

    1. Add two Text Input controls (TextInput1 and TextInput2).

    2. Add a Label to the canvas to display the result.

    3. 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

  • M_Ali_SZ365 Profile Picture
    1,110 on 09 Nov 2023 at 20:11:53
    Re: How to perform and display calculation

    Hi @jms0529 ,

    To perform and display calculations from two input fields in Power Apps:

    Use two Text Input controls (e.g., TextInput1, TextInput2) for users to enter numbers.
    Place a Label control to show the result.
    Set the Text property of the Label to:

    If(
     IsNumeric(TextInput1.Text) && IsNumeric(TextInput2.Text) && Value(TextInput2.Text) <> 0,
     Text(
     1 - (Value(TextInput1.Text) / Value(TextInput2.Text)),
     "0.0%"
     ),
     "Invalid input"
    )

    This formula calculates the result when both inputs are numeric and the second input is not zero, then formats it as a percentage. If the inputs are not valid, it displays "Invalid input".

    Please accept this solution if it resolves the issue.
    Best regards,
    Muhammad Ali

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 78 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 42

#3
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

Overall leaderboard
Loading started
Loading complete