web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / AddColumns adds a new ...
Power Apps
Answered

AddColumns adds a new column with all duplicating data

(0) ShareShare
ReportReport
Posted on by 6

Hello,

 

I have Three tables, call it A, B, and C. Table B have two lookup columns, the first 'Column A' is a lookup column reference to table A, it's relationship is many-to-one in the table property, but in the table it's either empty or only have unique link to a record in table A, the second lookup column 'Column C' is a lookup column reference to table C, it is a many-to-one relationship as well and have multiple record pointing to one record in table C.

 

When I try to do this:

 

ClearCollect(
 'Temp Table A',
 AddColumns(
 'Table A',
 "New Column",
 LookUp(
 'Table B',
 'Column A'.Id = Id,
 'Column C'.'Name'
 )
 )
)

 

 

The "New Column" in the collection will show only duplicates of one particular data, does anyone know what's going one have a potential solution?

 

Thank you!

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

    Hi @Eternal995,

     

    We may have to use an explicit record scope reference. Could you give the code below a try:

    ClearCollect(
     'Temp Table A',
     AddColumns(
     //Explicit record scope
     'Table A' As Main,
     "New Column",
     //Note: LookUp retrieves the first record that matches the condition
     LookUp(
     'Table B',
     //Id references table A record
     'Column A'.Id = Main.Id,
     'Column C'.'Name'
     )
     )
    )

     

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

    Thanks!

  • Eternal995 Profile Picture
    6 on at

    Thank you! that's works for me. I tried using 'ThisRecord.Id' but it doesn't work, what's the difference between using ThisRecord and this explicit record scope reference?

  • LaurensM Profile Picture
    12,516 Moderator on at

    @Eternal995 happy to help!

     

    ThisRecord is an implicit record scope reference. When using nested functions that loop through your datasource or have a condition parameter (e.g. Filter, AddColumns, LookUp, ForAll...) an explicit record reference is recommended.

     

    This way Power Apps does not have to 'guess' whether ThisRecord refers to (in your case) the LookUp or AddColumns scope. By defining your AddColumns record scope explicitly as 'Main', ThisRecord (implicit scope) now refers to the LookUp record scope. (ThisRecord. is optional, you don't have to write this and can simply reference the column name)

     

    I hope this helps!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard