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 Apps
Answered

DISTINCT

(0) ShareShare
ReportReport
Posted on by

Hi

 

Can anyone advise how I can use the DISTINCT function in a dropdown but still get access all the columns in the row. For example, I have a few rows with the same "Project Name" and I just want to see only one occurrence of the row but still get access to all columns. I can use DISTINCT but then this only provides the single column to use elsewhere and not the whole row. 

 

Many thanks. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    Hi @jed76 ,

    Use GroupBy and AddColumns

    AddColumns(
     GroupBy(
     ListName,
     "YourDistinctColumn",
     "Data"
     ),
     "Field1",
     First(Data).Field1,
     "Field2",
     First(Data).Field2,
     . . . . . 
    )

     

    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.

    Visit my blog Practical Power Apps

  • jed76 Profile Picture
    on at

    Many thanks Warren. 

     

    I'm struggling a little here. All of my fields are labelled "field1, field2" etc. The actual columns names don't appear to be showing?

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    Hi,

     

    As you said, when using DISTINCT() you will get only one column as Result. What you can do down the line is query the datasource or even a collection you have made in OnStart, for instance.

     

    Let's say your table is called Projects; you can do a couple of collections OnStart:

     

    Collect( colDistinct, Distinct( Projects, Name ) );

    Collect ( colProjects, Projects )

     

    You can then use colDistinct in a DropDown for instance and colProjects in a gallery Filter( colProjects, Name = Dropdown.Selected.Result)

     

  • jed76 Profile Picture
    on at

    Also, are the " " required?

  • jed76 Profile Picture
    on at

    Hi

     

    Many thanks. I have tried this, but when I set the Dropdown to colDistinct, I can still only access the "result" from this, namely the single column?

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    In the dropdown, yes, my suggestion was to use that dropdown to cycle through projects and get their details in a gallery.

     

    @WarrenBelz may be closer to what you are looking for.

  • jed76 Profile Picture
    on at

    Aah yes - I see. I will give that a go. Many thanks!

  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    Hi @jed76 ,
    Field1 was only a placeholder - put the actual name of the field you want to retrieve in both places. Note you will get the first field in each distinct set.

     

    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.

    Visit my blog Practical Power Apps

  • jed76 Profile Picture
    on at

    @WarrenBelz 

     

    Sorry, what is "your distinct column" then? What is the difference between this and "field1"?

  • jed76 Profile Picture
    on at

    @WarrenBelz 

     

    I think I have got the function working now without an error but where does the function sit? I have put as ITEMS in the dropdown box, but now nothing shows when I select the dropdown?!

     

    Many thanks. 

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 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard