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 / 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

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