cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
muhammadh811
Regular Visitor

Sum of rows based on combobox selections

I have a table with 2 Columns

 

ExtraResult
A5
B10
C15

 

I am using Extra column in ComboBox and want sum of result column based on Combobox selection.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @muhammadh811 ,

Note Value may be different depending on the Items of the Combo Box

Sum(
   Filter(
      Table,
      Extra = ComboBox.Selected.Value
   ),
   Result
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @muhammadh811 ,

Note Value may be different depending on the Items of the Combo Box

Sum(
   Filter(
      Table,
      Extra = ComboBox.Selected.Value
   ),
   Result
)

 

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.

Visit my blog Practical Power Apps

@WarrenBelz 
Thank you for your reply. I tried this code but it is giving me result as per my 2nd selection. I need sum of both.
For example I choose A and B from Combo Box but it is showing result of B only.

Sum(
    Filter(
            'Extra List', Title = ComboBox1.Selected.Title),Cloth)

 

Hi @muhammadh811 ,

You did not mention multiple selections, so this gets a fair bit more complex. Note this will only work on list numbers up to your Delegation limit (I have only used the top statement to get rid of the warning)

With(
   {wExtra: 'Extra List'},
   Sum(
      Ungroup(
         ForAll(
            ComboBox1.SelectedItems As aSel,
            Filter(
               wExtra,
               Title = aSel.Title
            )
         ),
         "Value"
      ),
      Cloth
   )
)

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,413)