cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Calculate

Jag har en powerapp som beräknar fram priser då man anger timmar och materialkostnader. Jag skulle vilja ha en checkbox där man kan välja om det är ett pris till en befintlig kund eller ny kund. FÖr ny kund ser formeln ut Text(If (Value(TextInput1.Text)>4;(Value(TextInput1.Text)*1025*0,90);If(Value(TextInput1.Text)>2;(Value(TextInput1.Text)*1025*0,95);(Value(TextInput1.Text)*1025)))+(Value(TextInput2.Text)*1,20);"[$-en-US]#,###:-") och för en befintlig kund ser det ut så här Sum(TextInput1 * 1025)*0,9 + (TextInput2 * 1,20)*0,10 jag får det inte att fungera att priset ska visas i en ruta och bestå av valet jag gjort i checkboxen. Någon ide?

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @Anonymous 

 

With(
    {
        formulaChecked: (Value(TextInput1.Text) * 1025 * 0,9) + (Value(TextInput2.Text)  * 1,20 * 0,10);
        formulaUnchecked: Text(
            If(
                Value(TextInput1.Text)  > 4;
                Value(TextInput1.Text)  * 1025 * 0,90;
                Value(TextInput1.Text)  > 2;
                Value(TextInput1.Text)  * 1025 * 0,95;
                Value(TextInput1.Text)  * 1025 + Value(TextInput2.Text)  * 1,20
            )
        )
    };
    If(
        Checkbox1.Value;
        Text(formulaChecked;"[$-en-US]#,###:-");
        Text(formulaUnchecked;"[$-en-US]#,###:-")
    )
)

 

Please check the formulas to make sure the math is correct and that the "," and ";" are used correctly for your language.  Sum is used to calculate a value from a table and is not the right function to use in your formula.  There is no need to have multiple If() functions, PowerApps will check to see which of the conditions is true and then stop and proceed executing the appropriate function. 

 

 

View solution in original post

3 REPLIES 3
Drrickryp
Super User
Super User

Hi @Anonymous 

 

With(
    {
        formulaChecked: (Value(TextInput1.Text) * 1025 * 0,9) + (Value(TextInput2.Text)  * 1,20 * 0,10);
        formulaUnchecked: Text(
            If(
                Value(TextInput1.Text)  > 4;
                Value(TextInput1.Text)  * 1025 * 0,90;
                Value(TextInput1.Text)  > 2;
                Value(TextInput1.Text)  * 1025 * 0,95;
                Value(TextInput1.Text)  * 1025 + Value(TextInput2.Text)  * 1,20
            )
        )
    };
    If(
        Checkbox1.Value;
        Text(formulaChecked;"[$-en-US]#,###:-");
        Text(formulaUnchecked;"[$-en-US]#,###:-")
    )
)

 

Please check the formulas to make sure the math is correct and that the "," and ";" are used correctly for your language.  Sum is used to calculate a value from a table and is not the right function to use in your formula.  There is no need to have multiple If() functions, PowerApps will check to see which of the conditions is true and then stop and proceed executing the appropriate function. 

 

 

Anonymous
Not applicable

Ok, i will try this, thanx

Anonymous
Not applicable

Thank you very much it worked. 😀

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,103)