web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to go about assign...
Power Apps
Unanswered

How to go about assigning a number value to each value in a choice dropdown

(0) ShareShare
ReportReport
Posted on by 241

I have a choice dropdown that allows the user to select from a list of accessories for their vehicle. The purpose of the form is to get a price estimate on a new vehicle. As such, when they select their accessories I need each of these to have a linked value that can be added to a total at the bottom of the page. 

 

For example, they select a sunroof ($1000), floor mats ($100) and a bull-bar ($500). I want the total displayed at the bottom of the form to reflect the $1600 worth of accessories. 

 

Is there a way to do this without the user clicking a "calculate" button that runs the values? I'd like it to all happen as they select the options if possible, to make it easier to see recalculations.

Categories:
I have the same question (0)
  • Edwin-Abdalian Profile Picture
    641 on at

    I created a combobox (cmbAccessories) to replicate something similar to your application.combo.PNG

     

    Then I created a collection on "On Change" of the combobox:

    ClearCollect(colSelectedAccessoriesPrice, cmbAccessories.SelectedItems.Price)

    Then I created a label and set the value of it to Sum(colSelectedAccessoriesPrice.Price,Price)

     

    now when I make changes to the combo box, the total gets updated automatically.

    hope this helps.

     

    *************************************************

    If I helped you with solving the problem, please choose Accept as Solution and give me a Thumbs Up.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @rsparks 

     

    Multiple selection is not allowed in a dropdown bydefault. To enable the multiple selection, I would recommend you to use Combobox control. You can select a Double layout to show both item name and its value.
     
    Expression to get the total:
    Sum(ComboBox1.SelectedItems,Price)
     
    ComboBox1 is the name of control and Price is the name of column which stores the value.
     
    If the column that has price is a string type column with $ in it, you can update the expression to:
    Sum(ComboBox1.SelectedItems,Value(Substitute(Price,"$","")))
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • rsparks Profile Picture
    241 on at

    The combo box is directly linked to a choice column in the sharepoint list, so I don't think I'm able to assign each choice a second value. 

     

    Is there still a way to assign them a value in the form? Or alternatively can I patch the results of a freshly created combobox to the choice column in the list?

  • Edwin-Abdalian Profile Picture
    641 on at

    Where do you store the Price?  Do you have a Price List to keep the items and prices? 

  • rsparks Profile Picture
    241 on at

    There is a separate sharepoint list that contains the vehicle make/model and price, as well as insurance/fuel estimates. Based on which make/model the user selects from a drop down, I have some labels doing LookUp functions to find the value of each of the additional costs. 

     

    The combo box linked to the choice column however is all within the one column. In sharepoint it gives me the option to put all of the accessories as values for the choice, with the user able to select multiple.

     

    Possibly a workaround would be to have a list with each accessory and its value, and look those up based on which accessories are selected in the combobox?

     

     

  • rsparks Profile Picture
    241 on at

    The prices list looks like this:

     

    vehicle costs.PNG

     

    And the choices column (that is a combobox in powerapps by default) looks like this:

     

    choice column.PNG

  • Edwin-Abdalian Profile Picture
    641 on at

    yes, definitely you need a Price List for accessories and you need to bind it to your Combo box. I don't know how complicated your use case can get, but you need a List of Accessories that go only with certain type of cars. For example not all cars can have a rear spoiler.

     

    So,

    1- You need a Accessories Price List (Required columns : Item, Price)

    2- Bind a combo box to the Accessories Price List

    3- Patch the combobox selected items to your Estimate List (follow this video)

    4-you need a column in your Estimate list for "Total Price of the Accessories" so you patch the total there.

     

    I'm sure you will find a way to handle this quickly.

     

    *****************************

    If my answer solved your problem, please hit Accept As Solution. and If my post was helpful, please give me a Thumbs Up.

  • rsparks Profile Picture
    241 on at

    Would there be any way I could set it up so that the user could see the total cost change without needing to click a button to patch the results?

     

    For example, using a few hidden labels to calculate values? If I set up a list with the value for each accessory for each vehicle, could I have a label that reflects the values in the combobox? Even if I set up one label for each combobox option (10 or so). Label1 could be "If combobox value is rear spoiler, then 1, else 0", Label2 could be "If combobox value is roof racks then 1, else 0" etc.

    Then another 10 labels that would be "If Label1 equals 1, then Lookup "Vehicle Accessory Costs" with vehicle value as specified in a dropdown further up, and the accessory being rear spoiler". 20 labels total in this instance. Most would have a value of 0, and as such not affect the total price.

     

    The final calculation (SUM) field could then just SUM all of the second stage labels. 

     

    Could I then use IF statements to determine which accessory price information to patch? IF(Label1 = 1, patch Label1_Price, ""). 

     

    Or would it be less effort to get rid of the choice column altogether and simply patch a combobox across, and calculate the values from the combobox as it would simply have 2 values for each option?

  • Edwin-Abdalian Profile Picture
    641 on at

    yes, I'm refering you to my very first reply. the label gets populated automatically without clicking the submit button. users can see the Total price of the accessories in a label.

    I wouldn't take that path that you explained, it might work but think about maintaining your application. if you want to make a change in your accessories list then you need to change your app and publish a new one. I'm still voting for a separate nice and clean Price List.

     

  • rsparks Profile Picture
    241 on at

    How do I go about setting custom values for the combobox? I need it to reflect these values:

     

    some have values.PNG

     

    So Large 4WD and Ute have most of the accessories, but further down all vehicles will have the option for a fire extinguisher. Would it be better to link the combobox to this data or enter it manually as a "Table" or similar directly into the combobox? 

     

    Am I able to filter the options available in the combobox based on the vehicle selected in a separate dropdown? The reason I do this is to avoid users selecting for example a Tonneau Cover for a hatchback, but I don't think it's a huge issue if I can't as it should be common sense for most instances.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard