Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
KK123456
New Member

Adding columns from a list with same data whole way down

Hi, 

I'm relatively new to power query so need some help. 

I have a list with just one column and different data in each row and I have a table of data I'm working on. I want to add new columns to my table which takes the info in my list and pastes it the entire way down. The list i have has 60+ lines so trying to find a quicker way than add custom column for each one. 

Example: 

List      
A     
B     
C     
D     
      
Table      
Name info A (added column)B (added column)C (added Column)D (added column)
Andy1ABCD
Angela2ABCD
Kevin3ABCD
Jim 4ABCD



Thanks! 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @KK123456 

That's a slightly unusual requirement : )

 

If you have existing queries of this form:

List

(single-column table)

OwenAuger_0-1744111246639.png

TableSource

OwenAuger_1-1744111287242.png

then you could create a query like this to add columns with names & values both taken from List:

let
  ValuesList = List[List],
  #"Add List as Record" = Table.AddColumn(TableSource, "List", each Record.FromList(ValuesList, ValuesList)),
  #"Expand List to Columns" = Table.ExpandRecordColumn(#"Add List as Record", "List", ValuesList),
  #"Convert New Columns to Text" = Table.TransformColumns(
    #"Expand List to Columns",
    List.Transform(ValuesList, each {_, Text.From, type text})
  )
in
  #"Convert New Columns to Text"

 

OwenAuger_2-1744111530883.png

The main idea is to convert the list to a record where each field's name & value is an item from the list with Record.FromList, then add/expand this in a column.

 

Alternatively, you could construct a table rather than a record to produce the same result:

let
  ValuesList = List[List],
  #"Add List as Table" = Table.AddColumn(TableSource, "List", each #table(ValuesList, {ValuesList})),
  #"Expand to Columns" = Table.ExpandTableColumn(#"Add List as Table", "List", ValuesList),
  #"Convert New Columns to Text" = Table.TransformColumns(
    #"Expand to Columns",
    List.Transform(ValuesList, each {_, Text.From, type text})
  )
in
  #"Convert New Columns to Text"

 

Small PBIX attached to illustrate.

 

Can you adapt this to your model?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

9 REPLIES 9
v-echaithra
Community Support
Community Support

Hi @KK123456 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra E.

 

v-echaithra
Community Support
Community Support

Hi @KK123456 ,

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @KK123456 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra E.

dufoq3
Super User
Super User

Hi @KK123456, another solution:

 

Output

dufoq3_0-1744198124409.png

let
    List = Text.ToList("ABCD"),
    Table = Table.FromColumns({{"Andy","Angela","Kevin","Jim"}, {1,2,3,4}}, type table[Name=text, info=number]),
    AddedListToColumns = Table.FromRows(List.TransformMany(Table.ToRows(Table),
        each {List},
        (x,y)=> x & y), Table.ColumnNames(Table) & List.Transform({1..List.Count(List)}, each "Col" & Text.From(_)))
in
    AddedListToColumns

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

wdx223_Daniel
Super User
Super User

NewStep=Table.FillDown(Table.FromColumns(Table.ToColumns(YourTable)&List.Zip(YourList),Table.ColumnNames(YourTable)&YourList),YourList)

SundarRaj
Super User
Super User

Hi @KK123456 , here's a solution. In this case, I belive List.Accumulate would work brilliantly and automate the entire process. Thanks!

SundarRaj_0-1744121192191.png

SundarRaj_1-1744121211820.png

Here's the code:

= List.Accumulate(Cols,#"Changed Type",(s,c) => Table.AddColumn(s,c, each c))

Sundar Rajagopalan
PwerQueryKees
Super User
Super User

@OwenAuger beat me to it, but here is my solution:

let
    #"Table to add columns to" = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],  // The original table
    #"List of ColumnNames" = Excel.CurrentWorkbook(){[Name="Table1"]}[Content][List],  // Your list
    #"Converted to Table" = Table.FromList(#"List of ColumnNames", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Duplicated Column" = Table.DuplicateColumn(#"Converted to Table", "Column1", "Column1 - Copy"),
    #"Transposed Table" = Table.Transpose(#"Duplicated Column"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
    #"Added Custom" = Table.AddColumn(#"Table to add columns to", "New Columns", each #"Promoted Headers"),
    #"Expanded New Columns" = Table.ExpandTableColumn(#"Added Custom", "New Columns", #"List of ColumnNames")
in
    #"Expanded New Columns"



Did I answer your question? Then please (also) mark my post as a solution and make it easier to find for others having a similar problem.
Remember: You can mark multiple answers as a solution...
If I helped you, please click on the Thumbs Up to give Kudos.

Kees Stolker

A big fan of Power Query and Excel

p45cal
Super User
Super User

What form does the list take? I've assumed it starts life as a table.

See linked to workbook below.

It's probably not the slickest way!

 

First I took your list table, transposed it, appended it to itself (to create a duplicated row), promoted the first row as headers and left it at that.

Took your Name/Info table, added a custom column to bring in the list table, expanded that with a manual tweak o use the headers of the list table.

 

The workbook: https://app.box.com/s/p0jom6o7dmtgm100ymdyxwz13tngv32w

 

OwenAuger
Super User
Super User

Hi @KK123456 

That's a slightly unusual requirement : )

 

If you have existing queries of this form:

List

(single-column table)

OwenAuger_0-1744111246639.png

TableSource

OwenAuger_1-1744111287242.png

then you could create a query like this to add columns with names & values both taken from List:

let
  ValuesList = List[List],
  #"Add List as Record" = Table.AddColumn(TableSource, "List", each Record.FromList(ValuesList, ValuesList)),
  #"Expand List to Columns" = Table.ExpandRecordColumn(#"Add List as Record", "List", ValuesList),
  #"Convert New Columns to Text" = Table.TransformColumns(
    #"Expand List to Columns",
    List.Transform(ValuesList, each {_, Text.From, type text})
  )
in
  #"Convert New Columns to Text"

 

OwenAuger_2-1744111530883.png

The main idea is to convert the list to a record where each field's name & value is an item from the list with Record.FromList, then add/expand this in a column.

 

Alternatively, you could construct a table rather than a record to produce the same result:

let
  ValuesList = List[List],
  #"Add List as Table" = Table.AddColumn(TableSource, "List", each #table(ValuesList, {ValuesList})),
  #"Expand to Columns" = Table.ExpandTableColumn(#"Add List as Table", "List", ValuesList),
  #"Convert New Columns to Text" = Table.TransformColumns(
    #"Expand to Columns",
    List.Transform(ValuesList, each {_, Text.From, type text})
  )
in
  #"Convert New Columns to Text"

 

Small PBIX attached to illustrate.

 

Can you adapt this to your model?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.