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 / How do i fix distinct ...
Power Apps
Answered

How do i fix distinct not working properly?

(0) ShareShare
ReportReport
Posted on by 22

i am using distinct to make the list only show distinct names but for some reason it shows the distinct points for a name and not only the name. sorry i don't really know how to explain this because I've never experienced it before.

riley2_2-1717548434543.pngriley2_3-1717548446732.pngriley2_4-1717548453802.png

 

 

Categories:
I have the same question (0)
  • leonsig93 Profile Picture
    229 on at

    I don't think you need that ForAll around the Distinct if all you're trying to get is a list of all the names.

     

    Distinct wants a table first, then the column you want to filter down to unique values.

     

    Used a formula instead of a collection but it should all be the same:

    leonsig93_0-1717549553104.pngleonsig93_1-1717549642794.png

     

     

     

  • riley2 Profile Picture
    22 on at

    I'm using it for a text box, also the table is already created in a datastore legacy system table that has a separate column for the name and another for the points.

    I cant distinct a singular column because then it will only show said column where as i need it to show the points column too in the collection

  • leonsig93 Profile Picture
    229 on at

    Oh so you're trying to create a gallery that has a row per person not just a control, gotcha.

     

    So you still wouldn't use ForAll, but it does change how you'd go about it. Distinct will only ever give you a one column table (see Distinct Function)

     

    Are you trying to add up the points and show them as a total or do you need to show them individually?

     

  • riley2 Profile Picture
    22 on at

    you can make it show all the columns for each row using ThisRecord with a forall instead of just the name of the column you want to distinct. the only issue im having is its showing a row for each of the names that have a different amount of points

  • leonsig93 Profile Picture
    229 on at

    Right, but I think adding ThisRecord is sort of contradicting the Distinct. It won't throw an error but I don't think it will give you one row per name.

     

    You're trying to get something like this right?

    leonsig93_0-1717552206871.png

     

     

  • riley2 Profile Picture
    22 on at

    no, im trying to get this with a single collection (i currently use a separate collection for the points and another collection for the names and because of this im not able to sort it by the points since the gallerys items is used to distinct the names in the first collection so im trying to do it with 1 collection)

    riley2_1-1717552867457.png

     

  • Verified answer
    leonsig93 Profile Picture
    229 on at

    Okay this should be it. I left the inside gallery just to show the Points and then summed them.

    leonsig93_0-1717554017178.png

    What you need is to use GroupBy function and then you can use the Sum function to add up the Points table it creates

     

    So your items property turns into (replace fmlDistinct with your 'newcollection')

    AddColumns(
     GroupBy(
     fmlDistinct,
     Name,
     Points
     ),
     PointTotal,
     Sum(
     ThisRecord.Points,
     Points
     )
    )

    Doing it this way lets you use the collection you made and simply add a new column that totals the points for the person.

     

     

  • riley2 Profile Picture
    22 on at

    it seems to work but the points are being weird, it doesnt show the points

  • leonsig93 Profile Picture
    229 on at

    What's in your text field/whatever your using to display the points total?

  • riley2 Profile Picture
    22 on at

    i am just using thisitem.pointtotal

    it comes up with this 

    riley2_0-1717554902582.png

     

     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard