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

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

AddColumns Not Working

(0) ShareShare
ReportReport
Posted on by 92
Everytime I use "AddColumns" I get an error as I type in the name of the new column.   The column gets added to the collection before the command is entered, and it says there is a duplicate column.   
 
 
I have the same question (0)
  • AndrianaO Profile Picture
    199 Moderator on at
    AddColumns Not Working
    Hi! The table on the first screenshot is OpenRequirements, and the table on the second Screenshot is RequirementsC. The error in the formula indicates that the column "ClosedTag" already exists in the table OpenRequirements. Are you sure it is not there? 
  • JK-25091409-0 Profile Picture
    92 on at
    AddColumns Not Working
    That was my mistake, but it is happening on both RequirementsC and OpenRequirements.
  • AndrianaO Profile Picture
    199 Moderator on at
    AddColumns Not Working
    That is strange because AddColumns cannot modify the table you're using as an argument, this function creates a new table. 
    How are you creating these two tables? Do you collect them directly from the data source?
     
  • ronaldwalcott Profile Picture
    3,825 Super User 2025 Season 2 on at
    AddColumns Not Working
    Show the statement where you adding columns to OpenRequirements
  • JK-25091409-0 Profile Picture
    92 on at
    AddColumns Not Working
  • AndrianaO Profile Picture
    199 Moderator on at
    AddColumns Not Working
    Can you show how you create the original collection before you run AddColumns function? It is important to know if the column ClosedTag already exists (even though all the values in that column are empty). I suspect that instead of AddColumns you should try using:
     
    ForAll(OpenRequirements,Patch(OpenRequirements,ThisRecord,{ClosedTag:
    Concatenate(ThisRecord.ID,",",ThisRecord.Title)}))
     
    This code will update every record in your collection to have the correct value in ClosedTag column if this column do really exists
     
  • JK-25091409-0 Profile Picture
    92 on at
    AddColumns Not Working
    Andriana, When I used your code I got : "The specified column 'ClosedTag' does not exist".
  • JK-25091409-0 Profile Picture
    92 on at
    AddColumns Not Working
    I added this to the OnSelect of the list box I am choosing from:
     
    AddColumns(RequirementsC, TitleTag, Concatenate(ID, ". ", Title));
     
    I do not get a 'column exists' error, and the column does not show up under the collections variable.
  • Suggested answer
    AndrianaO Profile Picture
    199 Moderator on at
    AddColumns Not Working
    Oh, that is a good sign that the error disappeared and the column is expected not to show. The AddColumns() function does not create a column in the table you pass as a parameter to this function. You can read about it in the documentation
     
    That is why you need to add the results of your AddColumns() function to a new collection:
     
    Try this formula
     
    ClearCollect(colRequirementsC,AddColumns(RequirementsC, TitleTag, Concatenate(ID, ". ", Title)));
     
    The new column should appear in a new colRequirementsC table
  • JK-25091409-0 Profile Picture
    92 on at
    AddColumns Not Working
    It's still doing that, you can see the RequirementsC has a ClearCollect, and it pulls from the Requirements table which does not have a
    "TitleTag" column.   Actually if you look at the image of the collection above, the new columns are in fact showing up in RequirementsC.  That must be the problem, AddColumns is adding the new column to the collection instead of returning a new table.

    After some testing I think that's it, if you AddColumns to a Collection, they get added to the collection.  If you AddColumns to a table, it returns a new table.

    This works for me (Requirements is an actual table):

    AddColumns(Requirements, TitleTag, Concatenate(ID, ". ", Title))

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 853 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 489

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 393 Super User 2025 Season 2

Last 30 days Overall leaderboard