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 / Multiple columns in ga...
Power Apps
Answered

Multiple columns in gallery - Distinct filter

(0) ShareShare
ReportReport
Posted on by 105

Hi everyone,

I'd like to know how I could show multiple columns in gallery if a filter by Distinct.

 

My scenario:

SPlist1:

Cod EntityNumberCodeDescription
A1C1Description Code C1
A2N85Description Code N85
A3FB2Description Code FB2
B1C1Description Code C1
B2N85Description Code N85
B3FB2Description Code FB2

 

Gallery1:

Items: Distinct(SPList1,Number)

 

My problem: the gallery shows the column 'Number' as a result of Distinct, but I also want to add the columns 'Code' and 'Description'.

Gallery would be as this:

 

NumberCodeDescription
1C1Description Code C1
2N85Description Code N85
3FB2Description Code FB2

 

Thanks for your help.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @luisep 

    Consider using the GroupBy function instead of Distinct for this.  Distinct will give you a table with the Distinct values of the column you specify...and nothing else!

    GroupBy will allow you to group them as you need.

     

    So, this for your Items property formula:

       GroupBy(yourDataSource, "Number", "Code", "Description", "_records")

     

    Will produce the results you want.

    The _records column will have all the records that match that group (at least one).

     

    I hope this is helpful for you.

     

  • GPronnya Profile Picture
    74 on at

    @RandyHayes Hello, thanks for your reply. Can you please advice on how to perform COUNT of such distinct rows?

     

    and also how in gallery I can make additional labels to show values of other colums such as Record, Description.

     

    Thanks in advance.

  • mLarenas Profile Picture
    7 on at

    @RandyHayes That was the solution that i was looking for!, Thank you!!!!

  • jjacquet Profile Picture
    21 on at

    This solution works well for small datasets & this question. GroupBy() is not a delegable function, so if your dataset contains >500 records (or >2000 if you increase limit) you will likely get incomplete results if you're trying to apply this solution to something larger.

     

    I came across this while looking to do something similar against a SQL Server table with >10,000 records. This requires pre-filtering your dataset before executing the GroupBy().

     

    https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/delegation-overview#non-delegable-functions

     

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jjacquet 

    Delegation and Record Limit are two different things.  

    No function in PowerApps will ever return more than the record limit of the app.

     

    Criteria used in filters, lookups, etc. is what is subject to delegation.  It is either delegable to the datasource or not.

    However, that function will still never return more than the record limit.

     

    GroupBy, AddColumns, ShowColumns, RemoveColumns, Distinct, Index, Shuffle, Sort, SortByColumns, Ungroup, etc. are all functions that never delegate (because there is no criteria to delegate), so they are always restricted to the same record limits as all the other functions.

     

     

  • jjacquet Profile Picture
    21 on at

    @RandyHayes - of course, you're right & I realized my mistake shortly after hitting 'reply'. I apologize.

     

    The point does remain that there's a limit to using GroupBy, but the rationale was wrong.

     

    Appreciate your contributions to this forum!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jjacquet 

    No worries.  And it is an important thing to know...those functions do not delegate because there is nothing to delegate, so, they do what any other function would do...only return <record max> records.

     

    It is very common for people to try and work around delegation errors by using things like AddColumns to "shape" their data into something they can use to avoid delegation...but it is a futile effort because you are still only going to deal with the max record limit.

     

    Always happy to contribute!! 😁

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,009

#2
11manish Profile Picture

11manish 672

#3
Valantis Profile Picture

Valantis 628

Last 30 days Overall leaderboard