cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gowtham_1
Frequent Visitor

Making calculations in PowerApps

Hi

 

could anyone please help me to do the below calculation through PowerApps. Currently i use to work with excel to find the results using below formulas. I would wish to do the same using PowerApps. 

 

According to excel

Formula one  =0.001*(D12*D12*D14)/(2*G7) 

In Formula one - i will input two values (i.e. in D12 and D14 cells) in excel to find the result and other value mentioned in the above formula are constants (i.e. value in G7 cell)

 

Formula two =0.001*D19*D20*(1/D24)*(1-((D21/D19)^D23))

In Formula one - i will input two values (i.e. D19 and D20 cells) in excel to find the result and other value mentioned in the above formula are constants (i.e. values  in D24,D21 and D23 cells)

 

In PowerApps I would choose whether to do calculation using Formula 1 or Formula 2. Based on selection the respective screen should appear and then i will input the two values required for calculation as same i did in excel. Finally the result should appear on the screen

3 ACCEPTED SOLUTIONS

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

Hi @Gowtham_1

 

We can do formula's in Powerapps like below

0.001*(Value(D12.Text)*Value(D12.Text)*Value(D14.Text))/(2*Value(G7.Text)) 

 

StalinPonnusamy_0-1632544632510.png

 

I hope you got the concept for the formulas to use. 

 

Please let me know if you are looking in Gallery-like excel style format. We can do that as well.

 

View solution in original post

Hi 

 

Thanks a lot for your support... your solution works perfectly for Formula One... I seek your support for solving Formula two sir

In Formula two :  I have added a dropdown box for selecting the "test medium" (as shown in the below picture ).  If I choose test medium as " Helium" the parameters of helium should be taken for calculation or If I choose test medium as " Nitrogen" the parameters of Nitrogen should be taken for calculation... (parameter tables I have shown below). The blue highlighted text in parameter table refers  "inputs which will be entered by app user" and other parameters remains constant based on test medium. The formula for calculating these parameters is 0.001*D19*D20*(1/D24)*(1-((D21/D19)^D23)).  

At last my final request is based on the result, I need a to be display 3 types of text i.e. if the calculated result is less than 0.35 means "Text D " to be displayed in screen, if the calculated result is greater than 0.35 and less than 102 means "Text C " to be displayed, if the calculated result is greater than 102 and less than 271 means "Text B " to be displayed, if the calculated result is greater than 272 means "Text A " to be displayed, 

 

Gowtham_1_1-1632554013299.png

Gowtham_1_6-1632556589414.png    Gowtham_1_7-1632556616229.png

 

View solution in original post

StalinPonnusamy
Community Champion
Community Champion

Hi @Gowtham_1 

 

Looks like row 16 and 18 are not part of the calculation. Anyway, here is the solution based on the formula

 

Steps:

  • Have a collection to hold all constant data
  • Dropdown to select type
  • Label to show the calculation
  • Another label to show final text message

Set OnVisible property of the screen to

ClearCollect(
    Data,
    {
        type: "helium",
        parameters: {
            ValueVolumecc: 14970,
            ValueVolumem3: 0.01497,
            TestPressure: 101.3,
            phNm2: 11143000,
            vhm3: 0.01497,
            p1Nm2: 101325,
            Y: 1.4,
            y1y: 0.28571429,
            y1: 0.4,
            UKJ: 308.148933
        }
    },
    {
        type: "Nitrogen",
        parameters: {
            ValueVolumecc: 14970,
            ValueVolumem3: 0.01497,
            TestPressure: 101.3,
            phNm2: 11143000,
            vhm3: 0.01497,
            p1Nm2: 101325,
            Y: 1.666,
            y1y: 0.399759904,
            y1: 0.666,
            UKJ: 212.2082376
        }
    }
)

 

Set Dropdown Items property to

["helium","Nitrogen"]

 

Insert one Label (Name: CalculatedResult) and set text property to

With(
    {
        _item: First(
            Filter(
                Data,
                type = Dropdown2.Selected.Value
            ).parameters
        )
    },
    0.001 * Value(_item.parameters.phNm2) * Value(_item.parameters.vhm3) * (1 / Value(_item.parameters.y1)) * (1 - ((Value(_item.parameters.p1Nm2) / Value(_item.parameters.phNm2))^Value(_item.parameters.y1y)))
)

 

Insert another label to display the final text message

Set Text property of this label to

If(
    Value(CalculatedResult.Text) <= 0.35,
    "Text D",
    Value(CalculatedResult.Text) > 0.35 && Value(CalculatedResult.Text) < 102,
    "Text C",
    Value(CalculatedResult.Text) > 102 && Value(CalculatedResult.Text) < 271,
    "Text B",
    "Text A"
)

 

Here is my sample

StalinPonnusamy_0-1632584969573.png

 

View solution in original post

5 REPLIES 5
StalinPonnusamy
Community Champion
Community Champion

Hi @Gowtham_1

 

We can do formula's in Powerapps like below

0.001*(Value(D12.Text)*Value(D12.Text)*Value(D14.Text))/(2*Value(G7.Text)) 

 

StalinPonnusamy_0-1632544632510.png

 

I hope you got the concept for the formulas to use. 

 

Please let me know if you are looking in Gallery-like excel style format. We can do that as well.

 

View solution in original post

Hi 

 

Thanks a lot for your support... your solution works perfectly for Formula One... I seek your support for solving Formula two sir

In Formula two :  I have added a dropdown box for selecting the "test medium" (as shown in the below picture ).  If I choose test medium as " Helium" the parameters of helium should be taken for calculation or If I choose test medium as " Nitrogen" the parameters of Nitrogen should be taken for calculation... (parameter tables I have shown below). The blue highlighted text in parameter table refers  "inputs which will be entered by app user" and other parameters remains constant based on test medium. The formula for calculating these parameters is 0.001*D19*D20*(1/D24)*(1-((D21/D19)^D23)).  

At last my final request is based on the result, I need a to be display 3 types of text i.e. if the calculated result is less than 0.35 means "Text D " to be displayed in screen, if the calculated result is greater than 0.35 and less than 102 means "Text C " to be displayed, if the calculated result is greater than 102 and less than 271 means "Text B " to be displayed, if the calculated result is greater than 272 means "Text A " to be displayed, 

 

Gowtham_1_1-1632554013299.png

Gowtham_1_6-1632556589414.png    Gowtham_1_7-1632556616229.png

 

View solution in original post

StalinPonnusamy
Community Champion
Community Champion

Hi @Gowtham_1 

 

Sure, I will review and update you by EOD. 

StalinPonnusamy
Community Champion
Community Champion

Hi @Gowtham_1 

 

Looks like row 16 and 18 are not part of the calculation. Anyway, here is the solution based on the formula

 

Steps:

  • Have a collection to hold all constant data
  • Dropdown to select type
  • Label to show the calculation
  • Another label to show final text message

Set OnVisible property of the screen to

ClearCollect(
    Data,
    {
        type: "helium",
        parameters: {
            ValueVolumecc: 14970,
            ValueVolumem3: 0.01497,
            TestPressure: 101.3,
            phNm2: 11143000,
            vhm3: 0.01497,
            p1Nm2: 101325,
            Y: 1.4,
            y1y: 0.28571429,
            y1: 0.4,
            UKJ: 308.148933
        }
    },
    {
        type: "Nitrogen",
        parameters: {
            ValueVolumecc: 14970,
            ValueVolumem3: 0.01497,
            TestPressure: 101.3,
            phNm2: 11143000,
            vhm3: 0.01497,
            p1Nm2: 101325,
            Y: 1.666,
            y1y: 0.399759904,
            y1: 0.666,
            UKJ: 212.2082376
        }
    }
)

 

Set Dropdown Items property to

["helium","Nitrogen"]

 

Insert one Label (Name: CalculatedResult) and set text property to

With(
    {
        _item: First(
            Filter(
                Data,
                type = Dropdown2.Selected.Value
            ).parameters
        )
    },
    0.001 * Value(_item.parameters.phNm2) * Value(_item.parameters.vhm3) * (1 / Value(_item.parameters.y1)) * (1 - ((Value(_item.parameters.p1Nm2) / Value(_item.parameters.phNm2))^Value(_item.parameters.y1y)))
)

 

Insert another label to display the final text message

Set Text property of this label to

If(
    Value(CalculatedResult.Text) <= 0.35,
    "Text D",
    Value(CalculatedResult.Text) > 0.35 && Value(CalculatedResult.Text) < 102,
    "Text C",
    Value(CalculatedResult.Text) > 102 && Value(CalculatedResult.Text) < 271,
    "Text B",
    "Text A"
)

 

Here is my sample

StalinPonnusamy_0-1632584969573.png

 

View solution in original post

thanks you so much anna for your extended support... your solution meets the request exactly 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,508)