Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ih2+RhgEa9XQJHo51IB2DZ
Power Apps - Building Power Apps
Answered

Calculate a price based on selected text choices?

Like (0) ShareShare
ReportReport
Posted on 19 Jul 2022 12:07:08 by 45

Hi,

Please note that I'm new to PowerApps as well as this community. I hope I do everything right πŸ™‚

 

I'm creating a meeting order form for ordering food and drinks. I'm connecting to a SharePoint list from Powerapps. In the SharePoint list I have several choice fields, one of them being food items that can be selected(multiple selections are allowed). For each food item selected I then want to multiply the base price(which I currently don't have anywhere in the SharePoint list) of the item with the number of people attending the meeting. The prices should then be added to create a total cost of food and drinks for the meeting.

 

My problem is that I have no idea how to do this. I have looked at the Datacardvalue.selected.value, but I need numbers, not the text saved in the choice.

I'm not expecting anyone to provide me a "turn-key solution" to this but if anyone can at least point me in the right direction it will be a big help πŸ˜Š

 

Best regards,
Ken

Categories:
  • Verified answer
    DSKJ Profile Picture
    45 on 26 Jul 2022 at 12:43:45
    Re: Calculate a price based on selected text choices?

    I decided to redo the solution. Instead of a multiple choice field I opted to go for several checkboxes(1 per food item). It's then trivial to do calculations based on true/false of each item.

    I'll mark this as solution to make it easier for other people having the same issue

  • DSKJ Profile Picture
    45 on 20 Jul 2022 at 12:23:16
    Re: Calculate a price based on selected text choices?

    Hi again,

    Well, the solution works - partly πŸ™‚ 
    My choice field can have multiple selections and the lookup does not support that. I only get the value of the last selected food item. I tried messing around with a filter, but either my syntax is incorrect or It's not really what I should use.

    Any idea on how to solve that?

    BR Ken

  • DSKJ Profile Picture
    45 on 19 Jul 2022 at 12:44:16
    Re: Calculate a price based on selected text choices?

    Thanks a lot @JK6 looks like that will work for me πŸ™‚

    Br Ken

  • Verified answer
    JK6 Profile Picture
    15 on 19 Jul 2022 at 12:37:58
    Re: Calculate a price based on selected text choices?

    Hi!

     

    Just to get you started, I created a quick example on what could be the possibility to do.

     

    I would create a separate list,. e.g. FoodPrices

    JK6_0-1658233905571.png

    Create a connection with that in the application

    JK6_1-1658233970980.png

    Here, in FoodItems (thats the choice field that comes from the main list) I select a food item, in the Attendees I write the number of people (here for the example this is just a Number type column in SP) and then in PriceTotal it calculates the FoodPrice (from the new created list FoodPrices) * Attendees number (3 in this case).

    JK6_2-1658234025294.png

    In the PriceTotal function bar, I have this function:

    LookUp(foodPrices, DataCardValue2.Selected.Value = Title).Price * DataCardValue3.Text

    a LookUp funtion, that retrieves the price if the condition is met. The condition is that the selected value in the field FootItems (in this case it's "bread") is the same item in the new created list FoodPrices and then it times by attendees.

    JK6_3-1658234366886.png

    In the main list looks like this.

     

    But this is a very quick and easy solution, not taking in account any complicated stuff you might need in the background etc.

  • DSKJ Profile Picture
    45 on 19 Jul 2022 at 12:27:09
    Re: Calculate a price based on selected text choices?

    Thank you for you quick reply @rbrooks66, but my problem is that when the the food item are chosen they have values like "Banana", "Coffee" etc. I cannot convert those to numbers.

    Sorry if that was not clear in my initial post.

  • rbrooks66 Profile Picture
    143 on 19 Jul 2022 at 12:16:24
    Re: Calculate a price based on selected text choices?

    Use the Value(FieldName.Text) to convert a text to a number.  Here's a link to the functions available in Power Apps,

    https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-value

     

    Screenshot 2022-07-19 081327 Value.png

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
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 37 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 32

Overall leaderboard