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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps ListBox/ Com...
Power Apps
Answered

PowerApps ListBox/ ComboBox only selecting last selected rather than all.

(0) ShareShare
ReportReport
Posted on by 26

Hi,

 

I am creating an App where multiple selections from ListBox/ ComboBox need to be carried over to another control. Only the last selected item is being reflected in other control. I have tried many combinations with both Select.Value, SelectedItems.Value, use of different controls... Just anything you could think of. 

I have not been able to find a solution in existing posts and have tried use of a collection and the ForAll function, nothing.

 

I have used a ListBox in example shown, but I am having the same issue with both ListBox and ComboBox, have tried using a mixture and both seperately.

They are connected to an Excel data source.

First ListBox displays list of Countries, 2nd ListBox displays it's associated weightingFirst ListBox displays list of Countries, 2nd ListBox displays it's associated weighting

Formula used for 1st ListBox Items: 

Distinct(CountryWeighting,'Country w')

Formula used for 2nd ListBox Items: 

Filter(CountryWeighting,'Country w'=ListBox1.Selected.Result)

 

For 2nd ListBox when I tried using

Filter(CountryWeighting,'Country w'=ListBox1.SelectedItems)

&

Filter(CountryWeighting,'Country w'=ListBox1.SelectedItems.Result)

I get an error message stating "Invalid argument type" for both.

 

 

Selected1.pngSelected2.pngThese three images shows me making multiple selections on ListBox to the left (Angola, Australia and Azerbaijan). Multiple select is enabled on all ListBoxes used. Yet only the last selected result is reflectedThese three images shows me making multiple selections on ListBox to the left (Angola, Australia and Azerbaijan). Multiple select is enabled on all ListBoxes used. Yet only the last selected result is reflected 

Another quick example to further demonstrate this issue...

For the the Text input on the right labelled 1, the formula on Default is If(ListBox1_1.Selected.Value="Angola", "1") and for the Text input labelled 2, the formula on default is If(ListBox1_1.Selected.Value="Australia", "1"). Instead of all selected results being reflected, only the last selected result is reflected. Same as before, I tried replacing the Selected.Value of formula with SelectedItems and SelectedItems.Value, but to no avail, both return error messages same as before- 'Invalid Argument type' .For the the Text input on the right labelled 1, the formula on Default is If(ListBox1_1.Selected.Value="Angola", "1") and for the Text input labelled 2, the formula on default is If(ListBox1_1.Selected.Value="Australia", "1"). Instead of all selected results being reflected, only the last selected result is reflected. Same as before, I tried replacing the Selected.Value of formula with SelectedItems and SelectedItems.Value, but to no avail, both return error messages same as before- 'Invalid Argument type' .

 

I have tried fiddling around with using ForAll in the formula but cannot seem to get it working, and also tried using a collect to capture results, but collect does not update properly when items are unselected and selected.

 

Formula used on ListBox OnSelect for collection- Collect(CBCountries, {CBCS: ListBox1_1.SelectedItems}). This purple symbol appears on ListBox. Have to press on the symbol to open and then it displays as normal. But Collection not updating normally with SelectedItems from ListBox, the values displayed in the Collection do not correlate to what I have selected in ListBox.Formula used on ListBox OnSelect for collection- Collect(CBCountries, {CBCS: ListBox1_1.SelectedItems}). This purple symbol appears on ListBox. Have to press on the symbol to open and then it displays as normal. But Collection not updating normally with SelectedItems from ListBox, the values displayed in the Collection do not correlate to what I have selected in ListBox.

 

I have tried using PowerApps Data table and filtering that out according to listbox selected and galleries same thing. But the annoying issue of last selected is consistent through all approaches.

 

I have no clue where I am going wrong, what to do next or if there is some kind of issue with PowerApps mulitple selection in controls.

 

 

Looking forwarded to help and suggestions!!

Thank you.

Categories:
I have the same question (0)
  • Verified answer
    powerapps-dev Profile Picture
    26 on at

    Hi,

     

    I have found a solution to this.

     

    I was filtering the table from excel to show specified columns instead (on ListBox; items using Distinct(CountryWeighting,'Country w') for the first ListBox and Filter(CountryWeighting,'Country w'=ListBox1.Selected.Result) for the second ListBox) but in powerapps you can edit the controls in advanced settings to show certain columns instead. So something in the distnct/filter formula wouldn't allow select multiple. Now on first ListBox I simply have the name of the excel table CountryWeighting and on the ListBox to the right on items I have ListBox1.Selected Items.

     

     

    Current Problem as follows....

     

    I have a list of numbers being populated into a listbox (from another list box). I would like to be able to sum all the numbers/ items in the listbox. 

     

    ListBox to the right connected to an excel data source reflecting a country list. ListBox to the right is the associated weightings for the selected countries of ListBox to the right.ListBox to the right connected to an excel data source reflecting a country list. ListBox to the right is the associated weightings for the selected countries of ListBox to the right.

     

    Formula on Items for ListBox to the left:

    CountryWeighting (Name of excel table data source)

    Formula on Items for Listbox to the right:

    ListBox1.SelectedItems

     

    For the Text input below, on Default, I would like to sum all of the weightings/ numbers in the ListBox to the right.

    I have tried different filter combinations e.g.

    Sum(Filter(CountryWeighting, Weight=ListBox1.SelectedItems), Weight)

    This returns an error message stating 'Invalid argument type'. I have also changed the Text input format to Number, still no result.

    Sum(CountryWeighting, Weight), sums all the weightings in excel rather than those I have selected in App.

    I got 

    I got Sum(Filter(CountryWeighting, Weight=ListBox1.Selected.Weight), Weight) to work, but the value it is returning are incorrect and it's only returning the last selected item in the listbox rather than adding all value.

     

     

    Is this the correct approach to take? Are there alternative methods?

     

    All help appreciated,

    Best Regards

     

  • Verified answer
    powerapps-dev Profile Picture
    26 on at

    Solved,

     

    Using formula:

    Sum(ListBox2.SelectedItems, Weight) 

    On Text input default

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard