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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
v-xinruzhu-msft
Community Support
Community Support

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
v-xinruzhu-msft
Community Support
Community Support

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
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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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