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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.