Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Combobox with textinput showing sum of parts cost

(0) ShareShare
ReportReport
Posted on by 229

Hello,

Right now, I have a form with a dropdown with a parts list and a textinput that displays the cost of the part from the dropdown. Everything works great, but now I need to change the dropdown to a combo box so that I can select multiple parts and the cost of these will be added together and displayed in the textinput box. Then when I submit the form, I need all of the parts that have been selected put into one field ‘Parts Replaced’ and the combined cost to the ‘Parts Cost’ field on the table. Can you show me how this can be done?

 

My current setup:

Parts_List_Dropdown

Sort(Etching_Parts_Lists,'Item Description',Ascending)

 

Part_Cost_DataCardValue1

LookUp(Etching_Parts_Lists,'Item Description'= Parts_List_Dropdown.SelectedText.Value).'Parts Cost'

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    148,745 Most Valuable Professional on at
    Re: Combobox with textinput showing sum of parts cost

    Hi @Chrisguff12 ,

    You just need to split the output into the two fields - first one Parts Replaced

    With(
     {
     wCosts: 
     Concat(
     colCosts,
     'Item Description' & ", "
     )
     },
     Left(
     wCosts,
     Len(wCosts) - 2
     )
    )

    Second one - Parts Cost

    "$" & 
    Text(
     Sum(
     colCosts,
     Cost
     ),
     "[$-en]###,##0.00"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • BlessedCobba Profile Picture
    459 Super User 2024 Season 1 on at
    Re: Combobox with textinput showing sum of parts cost

    Try This,
    Parts_Cost_New_TextInput.Text has all the output you're after, you just need to split it into the columns you are after for your output

     

    Patch(
     Etching_Maintenance_Reports,
     Down_Machine_Details_Form.LastSubmit,
     { 
     'Machine is Down': "False",
     'Parts Replaced': First(Split(Parts_Cost_New_TextInput.Text, "-")).Result, 
     'Parts Cost': Last(FirstN(Split(Parts_Cost_New_TextInput.Text, "-"),2)).Result
     }
    )

     

  • Chrisguff12 Profile Picture
    229 on at
    Re: Combobox with textinput showing sum of parts cost

    Hi, @WarrenBelz 

    Thanks that is working better and I'm no longer getting the double results. 

     

    In my table it is only returning the one part in the 'Parts Replaced' Field. And the "Parts cost' Field has the part descriptions with the total price. I am guessing that I need to change my Onsuccess Property of the form in order to get the results I want. I have been trying to use the Split function but cant seem to get the correct parts in the right fields.  

    Current Results:

    Parts ReplacedPart Costs
    Blower 230VBlower 120V, Blower 230V - $2,173.00
    Power SupplyLaser Tube, Power Supply - $1,641.09

     

    I would like it to look like this

    Parts ReplacedPart Costs
    Blower 120V, Blower 230V$2,173.00
    Laser Tube, Power Supply$1,641.09

     

    Here is my current OnSuccess Property:

    Patch(
     Etching_Maintenance_Reports,
     Down_Machine_Details_Form.LastSubmit,
     {
     'Machine is Down': "False",
     'Parts Replaced': Parts_Replaced_ComboBox.Selected.'Item Description',
     'Part Costs': Parts_Cost_New_TextInput.Text
     }
    );

     

  • WarrenBelz Profile Picture
    148,745 Most Valuable Professional on at
    Re: Combobox with textinput showing sum of parts cost

    @Chrisguff12 ,

    See revised code - should work now. A bit tricky when working with this type of control.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Chrisguff12 Profile Picture
    229 on at
    Re: Combobox with textinput showing sum of parts cost

    Hello @WarrenBelz 

     

    Thanks for the quick response and for taking the time to customize the formulas to my data.

     

    Both parts you posted are working but for some reason when I select more then one item in the combo box it adds each item twice. 

    Cost of the items:

    Power supply: $346.09 / Laser Tube: $1,295

    Chrisguff12_0-1613784421797.pngChrisguff12_1-1613784466661.png

     

    Also I was wondering is there a way to have the Textinputbox only show the price and not the part names? When I submit the form I would like to have the date look like this in on the table. 

    Parts Replaced Parts costs
    Power supply, Laser Tube$1,641.09
  • Verified answer
    WarrenBelz Profile Picture
    148,745 Most Valuable Professional on at
    Re: Combobox with textinput showing sum of parts cost

    Hi @Chrisguff12 ,

    This is not a straight-forward process and what I am supplying should work, but is more syntax guidance to get you on your way. I have it working on a test model here, but have needed to change all the references to the ones you supplied, so if there is an issue please check these and the general logic to what you need. Firstly, if you put this on the OnChange of the Combo Box

    Clear(colCosts);
    With(
     {wCost: Self.SelectedItems},
     Collect(
     colCosts,
     AddColumns(
     wCost As aCost,
     "Cost",
     LookUp(
     Etching_Parts_Lists,
     'Item Description' = aCost.'Item Description'
     ).'Parts Cost'
     )
     )
    )

    Now the Default of your Text box containing the new information would be

    With(
     {
     wCosts: 
     Concat(
     colCosts,
     'Item Description' & ", "
     )
     },
     Left(
     wCosts,
     Len(wCosts) - 2
     )
    ) & " - $" & 
    Text(
     Sum(
     colCosts,
     Cost
     ),
     "[$-en]###,##0.00"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1