cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Z_Lukowski
Resolver I
Resolver I

Filter results From a gallery, based on column name where only duplicates would be shown?

Hello power users,

 I have a gallery in which I want so filter (based on one column values) If I have exactly 2 records for each of those values.

For example let's assume that column name is "Dog Name", I need to check if I have exactly two dogs with same name (for all the records) and filter all other Dogs with "Dog name" out. So results can be for example: 2 records with "Dog name"="fluffy", and 2 records with "Dog name" =" Goodboy". (If I would have 3 x "fluffy" in my gallery those should be also filtered out).  It's a gallery constructed from collection. 

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @Z_Lukowski,

You can set Items property of your gallery to below formula:

If(Toggle1.Value=true,Ungroup(ForAll(Distinct(collectionName,DogName),FirstN(Filter(collectionName,DogName=Result),2)),"Value"))

See results below, this is my collection with 6 records:

v-albai-msft_0-1614148822341.png

This is the filter results:

v-albai-msft_1-1614148822343.png

Best Regards,

Allen

View solution in original post

6 REPLIES 6
JR-BejeweledOne
Super User
Super User

How will you be providing the filter term to the gallery?    Do you have a dropdown, or a text input for this?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

@JR-BejeweledOne  I have a toggle on which "On check" property should do this action.

JR-BejeweledOne
Super User
Super User

By Toggle, I presume you mean a checkbox based on your 'OnCheck' property.  

 

Just a hint, it's super helpful if you refer to your controls by what type of control they are.   It makes it much easier to help as different controls have different properties and different ways that their results are accessed.

 

So your filter should look something like this:

 

Filter(GalleryXXx, 'Dog Name' = CheckBoxXXx.Value)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

@JR-BejeweledOne  Hello, I meant toggle input, not checkbox, and I don't need to filter gallery based on any checkbox value, but I need to find all Duplicates with same name (only duplicates, but not 3x/4x same name records etc, basically I want to pair those objects in the future if there are two results with same name)

 

Best Regards

Zbigniew

JR-BejeweledOne
Super User
Super User

My apologies, I didn't realize the toggle control had an OnCheck property.

 

So if your Toggle is true you want it the gallery to be filtered.   Where are you providing the filter value?   How will the filter know to look for a specific dog name?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
v-albai-msft
Community Support
Community Support

Hi @Z_Lukowski,

You can set Items property of your gallery to below formula:

If(Toggle1.Value=true,Ungroup(ForAll(Distinct(collectionName,DogName),FirstN(Filter(collectionName,DogName=Result),2)),"Value"))

See results below, this is my collection with 6 records:

v-albai-msft_0-1614148822341.png

This is the filter results:

v-albai-msft_1-1614148822343.png

Best Regards,

Allen

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,277)