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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show distinct items in...
Power Apps
Unanswered

Show distinct items in a gallery

(0) ShareShare
ReportReport
Posted on by 254

Hello, I have a gallery where I wrote a code to show more than 2000 items in a gallery, but when I filter I can see duplicates, because of my approach. How can I show only distinct items in gallery?

This is code in my gallery -> items

 //Filter already filtered SP list (first argument) based on conditions (second argument)
Filter(
 
 //Filter SP list and return items which match below criteria
 Filter(
 colAssignedOxrs,
 (drp_ViewScreen_FilterPane_Region.Selected.Value = Region And drp_ViewScreen_FilterPane_Team.Selected.Value = Team)
 ),

 //Check if field is blank or not. If it is blank return true, if it is not blank than check if trimed user input exist defined column in SPlist
 If(IsBlank(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text),
 true,
 Trim(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text) in 'OXR Assigned'
 ),
 If(IsBlank(txt_ViewScreen_StaticFilterPane_AccountNumber.Text),
 true,
 Trim(txt_ViewScreen_StaticFilterPane_AccountNumber.Text) in 'Account Number'
 ),
 If(IsBlank(txt_ViewScreen_StaticFilterPane_AccountName.Text),
 true,
 Trim(txt_ViewScreen_StaticFilterPane_AccountName.Text) in 'Account Name'
 ),
 If(IsBlank(txt_ViewScreen_StaticFilterPane_CoreId.Text),
 true,
 Trim(txt_ViewScreen_StaticFilterPane_CoreId.Text) in 'Core ID'
 ),
 If(IsBlank(txt_ViewScreen_StaticFilterPane_ReportsToManager),
 true,
 //check user input in columns "Reports to Person" and "Manager Person", because we don't know if user meant reports to person or manager
 Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Supervisor Or Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Manager
 )
)

This is example of my filtered gallery:

Gallery.png

You can see that these two items have the same 'Custom ID' - 2.

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    on at

    Hi @Aleksandra1 ,

     

    There must be some differences between the two items, since I don't think there could be exact same entries inside your data source table. Besides, I think you will need to let users to select an item and navigate to else place and view details. If you show distinct items in the Gallery, the selected item would be not specified. So, I don't think this is a valid method.

     

    Best regards,

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @Aleksandra1 

     

    You can use the Distinct function along with the Filter function.

     

    Distinct(
    Filter(
    Filter(
    colAssignedOxrs,
    (drp_ViewScreen_FilterPane_Region.Selected.Value = Region) && (drp_ViewScreen_FilterPane_Team.Selected.Value = Team)
    ),
    If(IsBlank(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text), true, Trim(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text) in 'OXR Assigned'),
    If(IsBlank(txt_ViewScreen_StaticFilterPane_AccountNumber.Text), true, Trim(txt_ViewScreen_StaticFilterPane_AccountNumber.Text) in 'Account Number'),
    If(IsBlank(txt_ViewScreen_StaticFilterPane_AccountName.Text), true, Trim(txt_ViewScreen_StaticFilterPane_AccountName.Text) in 'Account Name'),
    If(IsBlank(txt_ViewScreen_StaticFilterPane_CoreId.Text), true, Trim(txt_ViewScreen_StaticFilterPane_CoreId.Text) in 'Core ID'),
    If(
    IsBlank(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text),
    true,
    Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Supervisor || Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Manager
    )
    ),
    // Column name based on which you want to show distinct values
    'Column_Name'
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    HI @Aleksandra1 ,

    If you only want duplicates on CustomID

    With(
     {
     _Oxrs:
     Filter(
     colAssignedOxrs,
     (
     drp_ViewScreen_FilterPane_Region.Selected.Value = Region &&
     drp_ViewScreen_FilterPane_Team.Selected.Value = Team
     )
     )
     },
     AddColumns(
     GroupBy(
     Filter(
     _Oxrs,
     (
     IsBlank(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text) ||
     Trim(txt_ViewScreen_StaticFilterPane_OxrAssigned.Text) in 'OXR Assigned'
     ) &&
     (
     IsBlank(txt_ViewScreen_StaticFilterPane_AccountNumber.Text ||
     Trim(txt_ViewScreen_StaticFilterPane_AccountNumber.Text) in 'Account Number'
     ) &&
     (
     IsBlank(txt_ViewScreen_StaticFilterPane_AccountName.Text) ||
     Trim(txt_ViewScreen_StaticFilterPane_AccountName.Text) in 'Account Name'
     ) &&
     (
     IsBlank(txt_ViewScreen_StaticFilterPane_CoreId.Text) ||
     Trim(txt_ViewScreen_StaticFilterPane_CoreId.Text) in 'Core ID'
     ) &&
     (
     IsBlank(txt_ViewScreen_StaticFilterPane_ReportsToManager ||
     Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Supervisor || 
     Trim(txt_ViewScreen_StaticFilterPane_ReportsToManager.Text) in Manager
     )
     ),
     "CustomID",
     "Data"
     ),
     "CustomerName",
     First(Data).CustomerName,
     "AccountNumber",
     First(Data).AccountNumber,
     "Region",
     First(Data).Region,
    	 . . . . . .
     ) 
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard