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 / Get Item Totals From L...
Power Apps
Answered

Get Item Totals From ListBox selection

(0) ShareShare
ReportReport
Posted on by

Hello all!

 

I'm trying to build a PowerApp that will be used for re-ordering items from an inventory, but I'm running into an issue where I can't get the current item amount to show based on a selection from a listbox. Can someone help me out with the formula?

 

Applications_0-1658180125537.png

In the current quantity I want it to show the value I have in the columns "Quantity in Reorder" and "Quantity Overall" in the FFD Inventory SP list:

Applications_1-1658180168022.png

 

So it needs to filter that data source to the listbox selection and provide the sum of the values in those two columns. Any thoughts? 

 

Currently I have

Sum(Filter('FFD Inventory', Sum('Quantity in Reorder' && 'Quantity Overall'), ListBox1.SelectedItemsText.Value))

but it isn't working. 

 

Many thanks! 

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Applications 

    If your ListBox is set to the datasource items, then you simply need the following:

    ListBox1.Selected.'Quantity in Reorder' + ListBox1.Selected.'Quantity Overall')

     

    Avoid using the SelectedText property as it is deprecated.

     

    I hope this is helpful for you.

  • Applications Profile Picture
    on at

    My List box is distinct, here's the formula for the listbox:

    Sort(Distinct('FFD Inventory', Description), Ascending)

    The reason it's not datasourced is because if I use 'FFD Inventory'.Description' in Items it shows as blank:

    Applications_0-1658185219130.png

     

    So since it's not a direct datasource, how would your recommendation look via code?

    I tried this and it didnt work:

    Sum(Filter('FFD Inventory', Sum(ListBox1.Selected.'Quantity in Reorder' + ListBox1.Selected.'Quantity Overall')))

     

    Thank you!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Applications 

    Yes, that formula will not work.

     

    So my question though is this - if you are doing a distinct (meaning there could be more than one record with the same description), then when you do a sum, which record are you trying to sum??  Or are you trying to sum all of them?

     

    If you are trying to sum all of them, then this Formula should give you what you need:

    Sum(
     Filter('FFD Inventory', Description=ListBox1.Selected.Result), 
     'Quantity in Reorder' + 'Quantity Overall'
    )
  • Applications Profile Picture
    on at

    @Randy 

     

    Only reason I use distinct is because it showed the results - is there another function I can use rather than Distinct?

     

    Also, just trying to sum the columns "Quantity in Stock" and "Quantity in Reorder" from the SharePoint list.

     

    Hope this clarifies - thanks!

  • Applications Profile Picture
    on at

    Disregard, I was able to get the ListBox to be a direct datasource and then the formula you linked earlier worked. Thank you!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 226 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard