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 / Function to add column...
Power Apps
Unanswered

Function to add columns based on a list of column names with function

(0) ShareShare
ReportReport
Posted on by 382

I'm coming back to a post post from three years ago. The question then was, how to add columns based on a list.

 

I want to go further on the solution provided:

let myFunc = ( myTable, myNewColumnList) =>

let foo = List.Accumulate(

myNewColumnList,
myTable,
(current_table, new_name) =>

if List.Contains(Table.ColumnNames( current_table), new_name)
then current_table
else Table.AddColumn(current_table, new_name, each null)

)

in foo

in myFunc

 

The solution is working fine.

 

However instead of putting a null into each row I want to use a calculated value.

 

Anytime I replace the null in the above code with something like '_ +1' I get an error. (The reference to the current record (_) alone is working). It looks like _ is recognized as a record. I cannot 'hardcode' the name of the first column because this name is not always the same (myNewColumList is passed and can be any list).

 

My question now is, how to write a formula into that function.

Categories:
I have the same question (0)

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard