cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bradweiner
New Member

Multiple Select Multi-Filter of a Collection

Hi,

 

I am trying to create a collection that has 4 Comboboxes that are all multiselect and based upon the selections it will filter the collection. The coding I have that is somewhat working except it is creating duplicates is as follows.

 

//ColumnA

 

If(CountRows(comboboxA.SelectedItems)>0,ForAll(comboboxA.SelectedItems.Value As myData,Collect(colfilteredcontent,Filter(colToBefiltered,myData.Value in columnA.Value))));ClearCollect(colToBefiltered,colfilteredcontent);Clear(colfilteredcontent);

 

//ColumnB

 

If(CountRows(comboboxB.SelectedItems)>0,ForAll(comboboxB.SelectedItems.Value As myData,Collect(colfilteredcontent,Filter(colToBefiltered,myData.Value in ColumnB.Value))));ClearCollect(colToBefiltered,colfilteredcontent);Clear(colfilteredcontent);

 

//ColumnC

 

If(CountRows(comboboxC.SelectedItems)>0,ForAll(cbPlatformC.SelectedItems.Value As myData,Collect(colfilteredcontent,Filter(colToBefiltered,myData.Value in ColumnC.Value))));ClearCollect(colToBefiltered,colfilteredcontent);Clear(colfilteredcontent);

 

//ColumnD

 

If(CountRows(comboboxD.SelectedItems)>0,ForAll(comboboxD.SelectedItems.Value As myData,Collect(colfilteredcontent,Filter(colToBefiltered,myData.Value in ColumnD.Value))));ClearCollect(colToBefiltered,colfilteredcontent);Clear(colfilteredcontent);

 

The "colfilteredcontent" is the result of the filter which is then saved to the "colToBeFiltered" for the final display. The info is filtering properly but it is also repeated the info in the final collection I want to display. I've tried both the "Distinct" and "GroupBy" functions but they case so many other issues that it won't work. Any help is much appreciated.

 

Thanks!

0 REPLIES 0

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,646)