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 / Compare specific value...
Power Apps
Answered

Compare specific value in gallery with all items in SP list

(0) ShareShare
ReportReport
Posted on by 178

I have a gallery with multiple items, and when a button is clicked, I want to check whether a specific value in a column can be found anywhere else in the SharePoint list.

 

Example from list:

Title     |   Internal ID    

1          |   123                

2          |   456                

3          |   456               

4          |   456               

 

In my Gallery, I have listed Title 1 and 2 (not 3 and 4).

When the button is clicked, I want it to count the number of items in the list with the same internal ID (should be 1 and 3, in the example above, but only update context if > 1).

I've tried to use CountIf with the statement, but I just cannot figure out how to check all records in the SP list (I could do it by adding a non-visible gallery which displays all items in list, but that would make more clutter in the app than necessary).

Categories:
I have the same question (0)
  • AlexTheKidd Profile Picture
    178 on at

    So I think I figured it out. If someone could confirm that it's correct, that'd be great!

     

    ForAll(
     Gallery.AllItems,
     If(
     CountIf(
     SPList,
     InternalID = ThisRecord.InternalID
     ) > 1,
     UpdateContext({showWarning: true })))
  • AlexTheKidd Profile Picture
    178 on at

    So it's obviously wrong, as it's not working as intended....

     

    I replaced CountIf with CountRows(Filter(....), but this also seems to fail. 

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @AlexTheKidd ,

     

    Please just try below formula (If the button is for each Gallery item):

    If(
     CountRows(
     Filter(
     SPList,
     InternalID = ThisItem.InternalID
     )
     ) > 1,
     UpdateContext({showWarning: true })
    )

     

    Best regards,

  • AlexTheKidd Profile Picture
    178 on at

    Hi @v-jefferni ,

     

    This works if the button is in the gallery, but in my case, it is not, which is where I'm struggling 🙂

  • AlexTheKidd Profile Picture
    178 on at

    No longer needed, as we're redesigning the entire app.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard