cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Applications
Helper I
Helper I

Getting the Sum of Values from a ComboBox GroupBy and Filter Functions?

So let's start with that I'm new to PowerApps and I tend to watch YouTube videos to help guide me on how to build the way I need to haha.

 

But here's my current problem-set and what I need accomplished:

- SharePoint List dataset with multiple items that have the same name with different values, it was a "on-the-go" inventory sheet, example:

 

Buildings

EquipmentAmount
Building 1Monitor12
Building 12Monitor3
Building 2Monitor11
Building 1Monitor9

 

- Cascading ComboBoxes because it needs to be grouped for singularity, then filtered down by equipment in buildings

- My current problem is that I need to display the sum of the equipment after those two ComboBoxes have been selected, see below for example:

 

ComboBox1: Which building you're selecting:

GroupBy('Tracker', "{Name}", "Buildings")

 

ComboBox2: Which equipment youre selecting from that building:

GroupBy(Filter('Tracker', Building = ComboBox1.Selected.'{Name}'), "Item", "TEST")

 

And this is where I'm at, I've tried doing labels and text input boxes for displaying the sum of the values from ComboBox2 but I fail every time. I would greatly appreciate some help with this one! And if I'm doing this in a way that isn't efficient, I'll take guidance on that too haha. Thank you all!

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Super User
Super User

@Applications Please try the following,

Set the Items property of the first ComboBox to, Distinct(Tracker, Buildings)

Set the Items property of the second ComboBox to, Distinct(Filter(Tracker, Buildings=ComboBox1.Selected.Result), Equipment)

Set the Text property of the Label to, Sum(Filter(Tracker, Buildings=ComboBox1.Selected.Result && Equipment=ComboBox2.Selected.Result), Amount)

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @Applications ,

What is the '{Name}' field you refer to - it is not in the list you have posted.

RuneBH
Frequent Visitor

Hi Applications 🙂

 

If I understand you correct you want to get the total amount of the equipment selected in combobox2? If so try to add a label and for the text property insert this formula:

 

Sum(Filter(tracker, Equipment in ComboBox2.SelectedItems), Amount)

 

Where "tracker" is the SharePoint list that holds all the buildings and equipments, and where Equipment and Amount are the corresponding columns from that list. 

 

This should work even if you Amount field in SharePoint is text type field. 

 

 

CNT
Super User
Super User

@Applications Please try the following,

Set the Items property of the first ComboBox to, Distinct(Tracker, Buildings)

Set the Items property of the second ComboBox to, Distinct(Filter(Tracker, Buildings=ComboBox1.Selected.Result), Equipment)

Set the Text property of the Label to, Sum(Filter(Tracker, Buildings=ComboBox1.Selected.Result && Equipment=ComboBox2.Selected.Result), Amount)

View solution in original post

So I changed ComboBox 1 to this, it works perfectly, but when I changed ComboBox 2 I get a blank dropdown:

 

Applications_0-1638915715153.png

And since none of the values are in there the label doesn't recognize anything to sum it. Any suggestions?

@Applications Check this for the 2nd ComboBox,

CNT_0-1638954789938.png

 

Perfect, and everything else worked as intended now - thank you so much!

@Applications 

Glad to help!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,838)