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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
PietroFarias
Resolver II
Resolver II

Transform two columns and a table

I have two columns (or it can be a list) with the same number of rows. I would like to create a table that has the two columns (or lists) combined as in the example in the image. Which function or step should I follow?

 

Sample.png

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can start a new blank query and use Table.FromColumns to get your result

 

= Table.FromColumns({Name[Name], Age[Age]})

 

It needs a list of table names.  You can create a list from a query column with the syntax above - QueryName[ColumnName]

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

You can start a new blank query and use Table.FromColumns to get your result

 

= Table.FromColumns({Name[Name], Age[Age]})

 

It needs a list of table names.  You can create a list from a query column with the syntax above - QueryName[ColumnName]

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat ,I haven't used Table.FromColumns yet and it solved my case perfectly. Thank you.

 

@MattAllington I'm also using List.Zip, but this step does not solve it. Thank

HotChilli
Super User
Super User

Add an Index column in Power Query to both columns. (Both should start from the same number e.g.1)

Merge the tables using an Inner Join.

Personally, I would use List.Zip. Make sure both are lists first. 

https://excel.city/2017/11/how-to-use-list-zip-in-power-query/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.