web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter All But One Ite...
Power Apps
Unanswered

Filter All But One Item - Based On Field Value

(0) ShareShare
ReportReport
Posted on by 158

I have a bit of an advanced filter I need to write - I'd love to see some of your ideas on how you would do this.  

Here's the scenario:

I have a gallery that has two fields that will be considered in this formula: Product_ID and Barcode.  There are no repeating barcodes, but there are repeating Product_ID's - I want to see 1 of each of the Product_ID's.

 

Here's an example:

 

Raw Data:

 

Barcode | Product_ID
------------------------
1234 1

2345 1

3456 1

4567 2

5678 3

6789 4

 

 

Filtered:

 

Barcode | Product_ID
------------------------
1234 1

4567 2

5678 3

6789 4

 

 

Thanks in advance!

 

 

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Connor55
    You can do it like this:

    AddColumns(
     Distinct(RawData, Product_ID),
     "Barcode",
     LookUp(RawData, Product_ID=Result, Barcode)
    )


    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

  • GarethPrisk Profile Picture
    2,828 on at

    @mdevaneygot it!

    A few enhancements, if needed, below. First some context..

    Also this may not be delegable, given we are adding columns. @PowerAddict has a good blog on this topic, and here is the MSFT blurb for delegation works and how table shaping functions work.

     

    This 'enhanced' version renames the Result column for easier reference, and also implements a Sorting logic on the 'Raw Data' data source. Otherwise, the Lookup function will simply get the first record of the 'Raw Data' data set, and there is no predictable way to determine which record that will be.

    RenameColumns(
     AddColumns(
     Distinct(
     'Raw Data',
     Product_ID
     ),
     "Barcode",
     LookUp(
     SortByColumns(
     'Raw Data',
     "modifiedon", // Whatever column you want to order by
     Descending // Whichever orientation makes sense
     ),
     Product_ID = Result,
     Barcode
     )
     ),
     "Result",
     "Product_ID"
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard