Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

AddColumns error - Column name already exists

I am trying to add some columns to a collection using the AddColumns function. The second argument - Column Name - returns the error: "Column name already exists". Doesn't matter what value I enter for the name. Has anybody encountered this before? Or is there something else wrong in my syntax causing this?...




Collect(colReportData, AddColumns(colReportData, "NewColumn", LookUp(BP_Deliverables, ID = Value(colReportData[@Title]), 'Start Month')))



The AddColumns function is underlined - returns the error. The rest works. 


Thank you!

Helper II
Helper II


Hopefully i can help you. 

I have to try it by myself to be sure, but I’m assuming that the ‘Collect’ should be a ClearCollect. Because if I’m looking to your formula it seems that you are adding the column every time so the next time it will exist. A ClearCollect will prevent that.

In your formula it shouldn’t be a issue to use ClearCollect instead of Collect. 

I’ve you have any further questions please let me know. 

kind regards

Thank you so much Jaco. I sort of got it to work by writing this monstrosity: 


learCollect(colReport, ShowColumns(BP_PeopleAssigned,"Title", "Name2", "Team2", "Category"));
ClearCollect(colReport, AddColumns(colReport1, "Status", LookUp(BP_Deliverables, ID=colReport1[@Title],'Status1')));
ClearCollect(colReport3, AddColumns(colReport2, "StartMonth", LookUp(BP_Deliverables, ID=colReport2[@Title],'Start Month')));
ClearCollect(colReport4, AddColumns(colReport3, "EndMonth", LookUp(BP_Deliverables, ID=colReport3[@Title],'End Month')));
ClearCollect(colReport5, AddColumns(colReport4, "StartQuater", LookUp(BP_MonthsList, MonthValue=colReport4[@StartMonth], Quater)));
ClearCollect(colReport6, AddColumns(colReport5, "EndQuater", LookUp(BP_MonthsList, MonthValue=colReport5[@EndMonth], Quater)));
ClearCollect(colReport7, AddColumns(colReport6, "Deliverable", LookUp(BP_Deliverables, ID=colReport6[@Title], Title)));

ClearCollect(colReportData, RenameColumns(colReport7, "Title", "ID", "Name2", "EmployeeName", "Team2", "Team", "Category", "Role"))

I'm sure there must be a way to not create brand new collections for each column I need to add, but I can't seem to get it to work by modifying the same collection. If I try ClearCollect on the same collection, I get another weird error for the = operator in the Lookup saying that the right side is a table and the left side is text, and cannot be compared... Alas, I do get to a final collection with the data shaped the way I want.....

Helper II
Helper II



Great to hear it sort of works but it’s not optimal. The first thing you can do to improve the formula is by instead using multiple AddColumns use one. 

AddColumns( Table, ColumnName1, Formula1 [, ColumnName2, Formula2, ... ] )


If this doesn’t work you also can put all the AddColumns behind each other in the same ClearCollect. That would be something like this


AddColumn(‘collection’, ‘formula’),

AddColumn(‘collection’, ‘formula’),

AddColumn(‘collection’, ‘formula’),

ect. )


I hope this helps you improving your formula.

kind regards

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,779)