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

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,390)