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

Formula in powerapp

Hello,

In my app i have 2 fields: products and price . The third field is count. I want in the next field the result of count*price.

How can i achive that?

Thx.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Formula in powerapp

THX Bof, nice solution!

View solution in original post

9 REPLIES 9
Highlighted
Super User
Super User

Re: Formula in powerapp

@adk 

Assuming that the names of the two labels in question are lblPrice and lblCount, set the Text property of the new label to Value(lblPrice.Text)*Value(lblCount.Text)

Tip: as a shortcut, you can use 1*(lblPrice.Text) in place of Value() to change Text to a number in PowerApps.

Highlighted
Frequent Visitor

Re: Formula in powerapp

I get the message invalid argument.

The price is a number field and count a textfield, is that the problem?

Highlighted
Super User
Super User

Re: Formula in powerapp

@adk 

Possibly, but wrapping it in Value() should change it to a number for the calculation.  Try using the actual field names instead of the labels in your formula.

Highlighted
Helper III
Helper III

Re: Formula in powerapp

I got it working!! please let me know if this is what you are looking for.

KranthiTupakula_0-1596213320993.png

My Sharepoint data source with  Title: text, Price: Number and Count:Text

KranthiTupakula_0-1596213623103.png

 

 

Highlighted
Frequent Visitor

Re: Formula in powerapp

Thx for helping me.

In my SP list i do not have a count column, the count will be be made in the Power app.

And the price column is a dropdown list.

 

Highlighted
Microsoft
Microsoft

Re: Formula in powerapp

Hi @adk :

Do you want to group data by product and price, and then get the quantity and total price?

1.JPG

Does price allow multiple selections?

I assume price do not allow multiple selections.I've made a test for your reference:

My data source:

2.JPG

1\Add a datatable and set it's Itmes property to:

 

RenameColumns(
    AddColumns(
        GroupBy(
            AddColumns(
                List3,
                "Theprice",
                Value(price.Value)
            ),/*Add the field Theprice to get the unit price of the product in text format*/
            "products",
            "Theprice",
            "Group"
        ),/*Group records according to products and Theprice*/
        "Count",/*Create new field Count*/
        CountRows(Group), /*Calculate the number of records contained in each group*/
        "count*price",/*Create new field count*price*/
        CountRows(Group) * Value(Theprice) /*Calculate the total price*/
    ),
    "Theprice",
    "price" /*Renamed Theprice to price*/
)

 

Best Regards,

Bof

Highlighted
Frequent Visitor

Re: Formula in powerapp

Thank you all!

 

In the example you can see what i want to achive:

In the app people can put in a number to order a product. There must be a total in the last column.

The product column is a dropdown list from SP, the price column is attached to that column.

 

Highlighted
Microsoft
Microsoft

Re: Formula in powerapp

Hi @adk :

Please try this:

1\Add a Blank Vertical gallery

Items

 

List3

 

2\Add a label control into this gallery

Text

 

ThisItem.products.Value

 

1.JPG

3\add a label into this gallery

Text

 

ThisItem.price

 

4\Add a textinput control (TextInput2) into this gallery

5\Add a label into this gallery

Text

 

Value(ThisItem.price)*Value(TextInput2.Text)

 

25.gif

Best Regards,

Bof

 

 

Highlighted
Frequent Visitor

Re: Formula in powerapp

THX Bof, nice solution!

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,130)