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
ArquimedesP
Helper I
Helper I

Two columns into One with M code

Hi, I need some help with my M code. 

 

I have a large table and I need to take two columns from it and turn them into one. I'm trying to accomplish this with this M code:

 

let
Origen = Table.Distinct(Table.SelectRows(Table.SelectColumns(VW_BT_Desembolsos,{"Solicitud_Asoc"}),each ([Solicitud_Asoc]<> 0 and [Solicitud_Asoc]<> null))),
_table_final_1 = Table.TransformColumnTypes(Origen, {{"Solicitud_Asoc", type text}}),

Origen2 = Table.SelectRows(Table.SelectColumns(VW_BT_Desembolsos,{"Solicitud_Asoc","Cuit_Producto_"}),each ([Solicitud_Asoc]= 0 or [Solicitud_Asoc]= null)),
_table_final_prev3 = Table.Distinct(Table.SelectColumns(Origen2,{"Cuit_Producto_"})),
_table_final_prev4 = Table.TransformColumnTypes(_table_final_prev3, {{"Cuit_Producto_", type text}}),
_table_final_2 = Table.RenameColumns(_table_final_prev4,{{"Cuit_Producto_", "Solicitud_Asoc"}}),
_table_final = Table.Combine({"_table_final_1","_table_final_2"})

in
_table_final

 

 

 

But I'm having this error:

 

ArquimedesP_0-1692381917544.png

 

Cannot cast value "_table_final_1" to type Table.

 

 

What am I missing?

 

PS:  can't share my table couse confideality policy. 

 

Thanks a lot. 

2 ACCEPTED SOLUTIONS
ronrsnfld
Super User
Super User

You are using literal strings. You need to refer to the tables themselves.

try:

_table_final = Table.Combine({_table_final_1,_table_final_2})

 

 

View solution in original post

Begginer mistake 😂 thansk a lot!

View solution in original post

3 REPLIES 3
ronrsnfld
Super User
Super User

You are using literal strings. You need to refer to the tables themselves.

try:

_table_final = Table.Combine({_table_final_1,_table_final_2})

 

 

Begginer mistake 😂 thansk a lot!

You're welcome. And I've made that mistake myself. Please consider marking my response as the answer.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors