Skip to main content
Community site session details

Community site session details

Session Id : SSnie+mRP2ldqBRAtkyB0K
Power Apps - Building Power Apps
Answered

DISTINCT

Like (0) ShareShare
ReportReport
Posted on 12 Jul 2022 08:08:18 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. 

  • jed76 Profile Picture
    on 12 Jul 2022 at 12:42:54
    Re: DISTINCT

    Brilliant - I'll give it another go. 

     

    Much appreciated. 

  • Verified answer
    WarrenBelz Profile Picture
    148,983 Most Valuable Professional on 12 Jul 2022 at 12:15:52
    Re: DISTINCT

    @jed76 ,

    No - GroupBy() does the same thing except the "Data" field is actually a table containing all the other fields matching it - which you simply get back with AddColumns and use the first record in each table. Your code should work

    AddColumns(
     GroupBy(
     'CRUD 2',
     "field_1",
     "Data"
     ),
     "field_2",
     First(Data).field_2,
     "field_3",
     First(Data).field_3
    )

     

    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 12 Jul 2022 at 12:12:23
    Re: DISTINCT

    I am unsure where to put this. The field I want to use is 'field_1'. Should there also still be the DISTINCT function somewhere as well?


    AddColumns(
    GroupBy(
    'CRUD 2',
    "field_1",
    "Data"
    ),
    "field_2",
    First(Data).field_2,
    "field_3",
    First(Data).field_3
    )

  • WarrenBelz Profile Picture
    148,983 Most Valuable Professional on 12 Jul 2022 at 11:27:40
    Re: DISTINCT

    @jed76 ,

    Can you please post your code (in Text) and also the field you are displaying in the drop-down (it should be the GroupBy (Distinct) column.

  • jed76 Profile Picture
    on 12 Jul 2022 at 10:55:04
    Re: DISTINCT

    @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. 

  • jed76 Profile Picture
    on 12 Jul 2022 at 09:33:17
    Re: DISTINCT

    @WarrenBelz 

     

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

  • WarrenBelz Profile Picture
    148,983 Most Valuable Professional on 12 Jul 2022 at 09:10:28
    Re: DISTINCT

    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 12 Jul 2022 at 09:09:51
    Re: DISTINCT

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

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on 12 Jul 2022 at 09:06:03
    Re: DISTINCT

    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 12 Jul 2022 at 08:59:36
    Re: DISTINCT

    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?

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete