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 / Distinct values of a c...
Power Apps
Answered

Distinct values of a collection + column

(0) ShareShare
ReportReport
Posted on by 4

Hey,

 

I want to create a collection "Referencias" using DISTINCT values of column ID from a SP List "Pending" (examples at the end).

 

The thing here is, I also want to add the "Cab_City" column to the collection, but showing only one record (always the same value for each GUID).

 

I've tried something like this but is not working properly.. any ideas??

 

 

 

ClearCollect(Referencias;
 RenameColumns(Distinct(Pending;SP_GUID);"Value";"Col_GUID")
);;
AddColumns(Referencias;"City";LookUp(Pending;SP_GUID=Referencias[@Col_GUID]).Cab_City);;

 

 

 

 

Thanks!

 

(Col) Desired Referencias:

GUIDCity
1London
2Madrid
3Paris

 

(SP) Pending:

GUIDCity
1London
2Madrid
2Madrid
3

Paris

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @rodh3ro,

     

    The code below will only fetch the distinct IDs, add city as a column and rename the Value field to GUID:

    RenameColumns(
     AddColumns(
     Distinct(
     Pending;
     SP_GUID
     ) As Main;
     "City";
     LookUp(
     Pending;
     SP_GUID = Main.Value
     ).Cab_City
     );
     "Value";
     "GUID"
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • rodh3ro Profile Picture
    4 on at

    thanks, works like a charm! (just make sure to create the collection first with collect)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard