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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
OmarSalahelDine
Regular Visitor

how to combine these two csv files with unmatched columns and the same row count ?

 Capture1.PNGCapture.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @OmarSalahelDine 

You can create two blank queries, then put the following codes to Advanced Editor in power query

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtYzsVTSUXLMSUrMy0w0tLQ0AvIM9MwMTZVidQhKm+mZGOLVbWiMR9pIz8KUfLsH0mnD0+WxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"sucides/100k pop" = _t, #"country-year" = _t, #"HDI " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"sucides/100k pop", type number}, {"country-year", type text}, {"HDI ", type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)
in
    #"Added Index"
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxJSszLTFTSUTK0tDQCUrmJOalAythU19REoTI1sagYJGekFKuDW7Ghqa4RQrElXrWmprrmCLWmeNWiOsKcBDfgV4vqBhMS3DAaEEM4IGIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Country = _t, year = _t, sex = _t, age = _t, suncides_no = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Country", type text}, {"year", Int64.Type}, {"sex", type text}, {"age", type text}, {"suncides_no", Int64.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index", {"Index"}, Query1, {"Index"}, "Query1", JoinKind.LeftOuter),
    #"Expanded Query1" = Table.ExpandTableColumn(#"Merged Queries", "Query1", {"sucides/100k pop", "country-year", "HDI "}, {"sucides/100k pop", "country-year", "HDI "})
in
    #"Expanded Query1"

 

Output

vxinruzhumsft_0-1677217635592.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @OmarSalahelDine 

You can create two blank queries, then put the following codes to Advanced Editor in power query

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtYzsVTSUXLMSUrMy0w0tLQ0AvIM9MwMTZVidQhKm+mZGOLVbWiMR9pIz8KUfLsH0mnD0+WxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"sucides/100k pop" = _t, #"country-year" = _t, #"HDI " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"sucides/100k pop", type number}, {"country-year", type text}, {"HDI ", type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)
in
    #"Added Index"
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxJSszLTFTSUTK0tDQCUrmJOalAythU19REoTI1sagYJGekFKuDW7Ghqa4RQrElXrWmprrmCLWmeNWiOsKcBDfgV4vqBhMS3DAaEEM4IGIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Country = _t, year = _t, sex = _t, age = _t, suncides_no = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Country", type text}, {"year", Int64.Type}, {"sex", type text}, {"age", type text}, {"suncides_no", Int64.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index", {"Index"}, Query1, {"Index"}, "Query1", JoinKind.LeftOuter),
    #"Expanded Query1" = Table.ExpandTableColumn(#"Merged Queries", "Query1", {"sucides/100k pop", "country-year", "HDI "}, {"sucides/100k pop", "country-year", "HDI "})
in
    #"Expanded Query1"

 

Output

vxinruzhumsft_0-1677217635592.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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