Power Query: new column value = list

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I want to add a new column to an existing table in power query. I need the value of that column equal a list that i created in power query named "Curve". How do I do this? Thanks for the help.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
An example

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Curve = List.Transform({1..Table.RowCount(Source)}, each Number.Power(_,2)),
    cols = Table.ToColumns(Source) & {Curve}, 
    headers = Table.ColumnNames(Source) & {"Curve (Parabola)"},
    Result = Table.FromColumns(cols, headers)
in
    Result

Book1
ABCDEFG
1Column1Column2Column1Column2Curve (Parabola)
2Acol2 item1Acol2 item11
3Bcol2 item2Bcol2 item24
4Ccol2 item3Ccol2 item39
5Dcol2 item4Dcol2 item416
6Ecol2 item5Ecol2 item525
7Fcol2 item6Fcol2 item636
8Gcol2 item7Gcol2 item749
9
Sheet1
 
Upvote 0
Thanks. My list "Curve" only has one column and one row (value). My list was a table table I that I transformed into a list in Power Query. There should only be one value in it. But I want to populate an entire column/field in another table with that value from the list (same value for all rows). Will this work for that? (sorry will be away from that spreadsheet so I will not be able to try your solution for another couple of hours. Thanks for the Help
 
Upvote 0
Thanks. My list "Curve" only has one column and one row (one value). My list was a table table I that I transformed into a list in Power Query.

I have an existing table named "Material_Distribution_Output" I want to add a new column to this table that will contain the value from the list named "Curve". (The same value in every row of the Material_Distribution_Output table).

Will this work for this? Sorry I will be away from this spreadsheet for several hours so I will not be able to try your solution until much later.

Thank you for your help. Very much appreciated.
 
Upvote 0
Do you want the the entire Curve list in each row of the new table? If not, I am not following what you are trying to do. If you can provide an example of the table, the list, and how the final table should look it should make things clearer.
 
Upvote 0
I got it.

I create transformed the table into a List in Power Query Editor. I then created a new column in my desired table. The formula I put in the table was "=Curve()"

Appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,223,692
Messages
6,173,864
Members
452,535
Latest member
berdex

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top