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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
SteelerFan
Frequent Visitor

Split a single row into multiple rows based on multiple columns

Hi,

 

I new to Power BI and new to this board.  I have an incoming table like this:

 

PIDM           College 1          Dept 1            College2       Dept2

1                  VP                     ART                AS                  PSY

 

My Final table should look like this:

PIDM         College           Dept

1                VP                    ART

1                AS                   PSY

 

I've tried using unpivot but the resulting table is

PIDM        College1       VP

                 Dept1            ART

                 College2        AS

                 Dept 2           PSY

 

Any help would be greatly appreciated.

 

Thanks so much!

2 REPLIES 2
SteelerFan
Frequent Visitor

In a reply from the EDNA forum this solution worked for me, hopefully it will help others.

 

let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQoLABKOQSEgMhhIBARHKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PIDM = _t, #"College 1" = _t, #"Dept 1" = _t, #"College 2" = _t, #"Dept 2" = _t]),

#"Changed Type" = Table.TransformColumnTypes(Source,{{"PIDM", Int64.Type}, {"College 1", type text}, {"Dept 1", type text}, {"College 2", type text}, {"Dept 2", type text}}),

#"Merged Columns" = Table.CombineColumns(#"Changed Type",{"College 1", "Dept 1"},Combiner.CombineTextByDelimiter(";", QuoteStyle.None),"College-Dept-1"),

#"Merged Columns1" = Table.CombineColumns(#"Merged Columns",{"College 2", "Dept 2"},Combiner.CombineTextByDelimiter(";", QuoteStyle.None),"College-Dept-2"),

#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Merged Columns1", {"PIDM"}, "Attribute", "Value"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),

#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Value", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Value.1", "Value.2"}),

#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Value.1", type text}, {"Value.2", type text}}),

#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Value.1", "College"}, {"Value.2", "Dept"}})

in #"Renamed Columns"

 

Thanks

wdx223_Daniel
Community Champion
Community Champion

=#table({"PIDM","College","VP"},List.TransformMany(Table.ToRows(YourTable),each List.Split(List.Skip(_),2),(x,y)=>{x{0}}&y))

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.