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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Hikmet_JCI
Helper I
Helper I

make rows into columns

Hi, everyone

need some help

 

I have a table where a column needs to be converted to Power Query
what is the best solution?

from like this

Hikmet_JCI_0-1667915151163.png

 

in like this

Hikmet_JCI_1-1667915298445.png

thanks

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

hI

 

BASE:three

vluwangmsft_1-1667982897830.png

 

Output result:

vluwangmsft_2-1667982923227.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8tY1NDI2MTVTitWJVvIt0ivOrCgBsw1NrEwMISwjK0Moy9TKyACN5YJmgFtmWSpEiRkRBsQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Anew", each if Text.Middle([A],1,1)="-" then [A] else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Bnew", each if Text.Middle([A],0,2)="Mr" then [A] else null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Cnew", each if Text.Middle([A],2,1)=":" then [A] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom2",{"Anew", "Bnew"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Cnew] <> null)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"A"})
in
    #"Removed Columns"

 

 


Best Regards
Lucien

View solution in original post

1 REPLY 1
v-luwang-msft
Community Support
Community Support

hI

 

BASE:three

vluwangmsft_1-1667982897830.png

 

Output result:

vluwangmsft_2-1667982923227.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8tY1NDI2MTVTitWJVvIt0ivOrCgBsw1NrEwMISwjK0Moy9TKyACN5YJmgFtmWSpEiRkRBsQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Anew", each if Text.Middle([A],1,1)="-" then [A] else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Bnew", each if Text.Middle([A],0,2)="Mr" then [A] else null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Cnew", each if Text.Middle([A],2,1)=":" then [A] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom2",{"Anew", "Bnew"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Cnew] <> null)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"A"})
in
    #"Removed Columns"

 

 


Best Regards
Lucien

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.