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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
LobsterLegend
Frequent Visitor

M Language Add New Column

New to PBI here. Attempting to combine data from 2 different tables in Query Editor. From what I've read, this seems a more appropriate place than would DAX. The first Table is Financial Statement Lines and the second is Financial Statemeant Headers (a super-category for lines). Very rookie question: when attempting to add a new column, I cannot reference a column from another table. It could be a simple syntax issue I am missing.

 

These are the Tables in reference.

LobsterLegend_0-1653676428853.png

 

Within GL FS Lines, I use Custom Column and attempt to use the Table.Column function to begin my formula. I can reference the other Table -- GL FS Headings -- just fine. But when I attempt to reference the column 'Header' from that Table, you can see that I am not given that option. Rather, I am given options for the current Table (GL FS Lines). Why can I not see any columns from the Table GL FS Headings?

LobsterLegend_1-1653676508930.png

 

Sampling of data in GL FS Lines:

LobsterLegend_2-1653676625066.png

 

Sampling of Data in GL FS Headings: (there's 2 columns for FS Line further to the right. It's a range so I'll have to use an additional function to account for that)

LobsterLegend_3-1653676661938.png

LobsterLegend_4-1653676711986.png

 

I appreciate your input.

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

As @Nathaniel_C points out, in order to add columns from another table, you generally merge the tables and expand the columns you're interested in.

 

Joining on a range makes this significantly more involved. Radacad has a good article on a very similar problem:

https://radacad.com/dates-between-merge-join-in-power-query

 

The key here is to expand the header table into a table you can merge with. So just like Reza creates a list of dates, you can create a list of lines in a custom column like this:

AlexisOlson_0-1653776142127.png

For the first row, this creates a list of integers from 20 to 160.

 

Expand that column and then do a standard merge.

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

As @Nathaniel_C points out, in order to add columns from another table, you generally merge the tables and expand the columns you're interested in.

 

Joining on a range makes this significantly more involved. Radacad has a good article on a very similar problem:

https://radacad.com/dates-between-merge-join-in-power-query

 

The key here is to expand the header table into a table you can merge with. So just like Reza creates a list of dates, you can create a list of lines in a custom column like this:

AlexisOlson_0-1653776142127.png

For the first row, this creates a list of integers from 20 to 160.

 

Expand that column and then do a standard merge.

Thanks! Worked like a charm.

Nathaniel_C
Community Champion
Community Champion

Hi @LobsterLegend ,
Merge the two tables, and during that process only select the one column that you wish to add to your base table.

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

Nathaniel_C_0-1653679377941.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




HenriqueReis
Resolver I
Resolver I

Hi,

 

Please, try to do a relation between those tables here, out of query:

HenriqueReis_0-1653679353773.png

 

Or try to merge those columns here, inside Power Query:

HenriqueReis_1-1653679419643.png

 

Regards!

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors