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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Coby
New Member

How to prepare multiple rows with two different colums

Hy, 
I would kindly ask your help. I have a table with many columns from SQL database. This database contain one colum which contain two ore more ID spearated with " ; " (semicolons). I can split column to separate columns. However I do not know how can I prepare multiple rows (other column data should be the same but the ID column sholud be different in Power Query?

 

Original table:

IDData 1Data 2
1000; 1001ab
1002cd
1003; 1004; 1005ef

 

My actual stage: (with split colum)

ID1ID2ID3Data 1Data 2
10001001 ab
1002  cd
100310041005ef

 

Neaded table:

IDData 1Data 2
1000ab
1001ab
1002cd
1003ef
1004ef
1005ef

 

Best regards,

Coby

4 REPLIES 4
Subash_Govind
Frequent Visitor

Below are the results code...

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nRR0lFySSxJVDCEMYyUYnWilQwNDAysFYAkSDwRiJNgwkZATjIQp8AEjMHqTMCkKVAiFYjTlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID", type text}, {"Data 1", type text}, {"Data 2", type text}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type1", "ID", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"ID.1", "ID.2", "ID.3"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"ID.1", Int64.Type}, {"ID.2", Int64.Type}, {"ID.3", Int64.Type}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type2", {"Data 1", "Data 2"}, "Attribute", "ID"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"ID", "Data 1", "Data 2"})
in
#"Reordered Columns"

Coby
New Member

Thanks. It is work.

Could you please define the column where should only split the data by ";" . I have other columns which contain ";" as well, but I would not split those. 

this code only split the first column

wdx223_Daniel
Super User
Super User

=#table(Table.ColumnNames(OriginalTable),List.TransformMany(Table.ToRows(OriginalTable),each Text.Split(_{0},";"),(x,y)=>{y}&List.Skip(x)))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.